摘要:
1.一个普通的加法如下 internal class Program { private static void Main(string[] args) { int s = sum(10, 20); Console.WriteLine("Sum is: " + s); } private stati 阅读全文
摘要:
需要用的包: 把之前的tcp修改成控件 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System 阅读全文
摘要:
先添加包 代码部分: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; us 阅读全文
摘要:
泛型允许你定义一个类、接口或方法时不指定具体的数据类型,而是使用一个或多个类型参数 类型安全:编译器在编译时检查类型,减少运行时错误。 代码重用:相同的代码可以处理不同的数据类型,避免重复代码。 性能:避免了装箱和拆箱的性能损失,尤其是在处理值类型时。 点击查看代码 using System; us 阅读全文
摘要:
两种遍历方法:for和foreach遍历 点击查看代码 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using 阅读全文
摘要:
例子展示: 设置一个动物类,dog类,cat类,使用虚方法改写 点击查看代码 using System; public class Animal { // 声明一个虚方法 public virtual void Speak() { Console.WriteLine("Animal speaks") 阅读全文
摘要:
写一个例子 基类敌人类(hp speed 方法 :move ai )派生出来两个类 boos类 type1enemy类 using System.Collections.Generic; using System.Linq; using System.Text; using System.Threa 阅读全文