摘要:
一、委托的声明方式 1、delegate,例:public delegate int MethodtDelegate(int x, int y);表示有两个参数,并返回int型。2、Action,例:Action<int> action = new Action<int>(TempFunction) 阅读全文
摘要:
委托是C#中最为常见的内容。与类、枚举、结构、接口一样,委托也是一种类型。类是对象的抽象,而委托则可以看成是函数的抽象。一个委托代表了具有相同参数列表和返回值的所有函数。先上一段代码: public class ClassA { public delegate int CalculationDele 阅读全文
摘要:
首先定义一个学生成绩类 public class StudentResult { public int Id { get; set; } public string No { get; set; } public string Name { get; set; } public int Num { 阅读全文
摘要:
1、重载 重载就是在同一个类中,方法名相同,参数列表不同。参数列表不同包括:参数的个数不同,参数类型不同等。返回的数据类型可以不相同。代码如下: public class ClassA { public void Search() public string Search(int a) public 阅读全文
摘要:
1、日期格式的坑 var cell = row.GetCell(i);//获取某一个单元格 var value = ""; if (cell != null) { if (cell.CellType == CellType.Numeric)//当单元格格式是数值或者日期的时候,CellType==N 阅读全文