摘要: interface IState { string Name { get; set; } //后件处理 IList Nexts { get; set; } Func Selector { get; set; } } class State : IState { pu... 阅读全文
posted @ 2017-02-02 20:45 诺贝尔 阅读(1416) 评论(0) 推荐(0) 编辑
摘要: 泛型不同参数类型生成的对象是相互独立的。 //如 Tuple ts; Tuple to; //ts to 是两个类型的对象。 很多时候,我们希望实现 to = ts 这种操作,为什么?因为看上去它应该如此。 为了达到这个目的,就要解决“泛型参数转换的问题”,这个问题的知识点是in out 泛型变体。老实说,这个问题本身不困难,只是非常不直观,很容易让人忘记。 首先一点,为了实现to = ts,实际... 阅读全文
posted @ 2017-02-02 16:18 诺贝尔 阅读(1345) 评论(0) 推荐(0) 编辑
摘要: lambda 传递ref参数有个语法bug,必须要显式书写参数类型。 //如 delegate bool FuncType(ref int num); FuncType func1; func1 = num => true; //错 func1 = (ref num) => true;//错 func1 = (ref int num) => true;//ok //并且,当一个参数书写类型,其... 阅读全文
posted @ 2017-02-02 13:54 诺贝尔 阅读(1400) 评论(0) 推荐(0) 编辑