摘要: 一、类的扩展方法 //帮助类标记为static public static class StringHelper { //扩展的方法也要标记为静态的 public static bool IsEmail(this string str)//this要紧跟扩展的类型 { bool result = t 阅读全文
posted @ 2018-12-22 17:01 Francis_Ray 阅读(268) 评论(0) 推荐(0) 编辑
摘要: 一、委托的理解 委托是一种类型(与枚举是一样的):特殊的地方是它指向一个方法 二、委托的使用场景:将一个方法抽象出来作为参数传递 class Program { static void Main(string[] args) { //MyDelegate md = (s) => { Console. 阅读全文
posted @ 2018-12-22 11:58 Francis_Ray 阅读(711) 评论(0) 推荐(0) 编辑