摘要:
基础知识 [1]静态构造函数(执行一次,调用静态成员或实例化时执行一次) [2]抽象类和接口的区别 1:抽象类有字段,构造函数,非抽象方法(C#新版本接口可以定义方法体),接口没有 2:抽象类不可多继承,接口可以 3:接口成员默认修饰符为public,不可显示声明其他修饰符,抽象类成员可使用多种访问 阅读全文
posted @ 2024-04-01 15:50
DaiWK
阅读(104)
评论(0)
推荐(0)
摘要:
public class ArrayClass { public ArrayClass() { array = new int[10] { 1, 2, 3, 4, 5, 7, 1, 2, 3, 4 }; list = new List<int>(); LinkedList = new LinkedL 阅读全文
posted @ 2024-04-01 15:34
DaiWK
阅读(37)
评论(0)
推荐(0)
摘要:
定义 public interface ICar { public void Drive(); } public class XiaoMiCar : ICar { public void Drive() { Console.WriteLine("正在驾驶小米汽车"); } } public clas 阅读全文
posted @ 2024-04-01 15:09
DaiWK
阅读(26)
评论(0)
推荐(0)
摘要:
定义 public interface ITraffic { void Drive(); } public class Car : ITraffic { public void Drive() { Console.WriteLine("车在陆地行驶"); } } public class Ship 阅读全文
posted @ 2024-04-01 15:08
DaiWK
阅读(23)
评论(0)
推荐(0)
摘要:
定义 /// <summary> /// 定义处理接口 /// </summary> public interface IHandler { public IHandler? next { get; set; } void Response(); } /// <summary> /// 定义处理类 阅读全文
posted @ 2024-04-01 15:07
DaiWK
阅读(27)
评论(0)
推荐(1)
摘要:
定义 //定义动物接口 public interface IAnimal { /// <summary> /// 动物名称 /// </summary> public string _Name { get; set; } /// <summary> /// 动物行动 /// </summary> v 阅读全文
posted @ 2024-04-01 15:06
DaiWK
阅读(31)
评论(0)
推荐(0)
摘要:
定义 public abstract class Yabo { public abstract void print(); } public class WuhanYabo : Yabo { public WuhanYabo() { Console.WriteLine("我是武汉鸭脖"); } pu 阅读全文
posted @ 2024-04-01 15:04
DaiWK
阅读(47)
评论(0)
推荐(0)
摘要:
/// <summary> /// 懒汉式 /// </summary> public class SingletonObjectLH { private SingletonObjectLH() { } private static readonly object lock_obj=new obje 阅读全文
posted @ 2024-04-01 15:03
DaiWK
阅读(14)
评论(0)
推荐(0)

浙公网安备 33010602011771号