摘要: 约束类: class Program { static void Main(string[] args) { List<Account> list = new List<Account>(); list.Add(new Account("张三", 156345.5M)); list.Add(new 阅读全文
posted @ 2015-04-14 19:49 江境纣州 阅读(77) 评论(0) 推荐(0)
摘要: class Program { static void Main(string[] args) { Person p1 = new Person("张三"); Person p2 = new Person("李思思"); Console.WriteLine(p1.CompareTo(p2)); Ca 阅读全文
posted @ 2015-04-14 16:42 江境纣州 阅读(56) 评论(0) 推荐(0)
摘要: 以前知道where T:class 和where T:struct的作用是约束T是自定义类类型还是值类型; 还有就是where T:new()的作用是约束必须有一个无参的构造函数。 但是对于where T:IFoo和where T:Foo,就只知道有这么一个约束,自己也没深入研究过,而且自己写的泛型 阅读全文
posted @ 2015-04-14 16:29 江境纣州 阅读(99) 评论(0) 推荐(0)