08 2013 档案
摘要:一、用属性代替可访问的字段 1、.NET数据绑定只支持数据绑定,使用属性可以获得数据绑定的好处; 2、在属性的get和set访问器重可使用lock添加多线程的支持。 二、readonly(运行时常量)和const(编译时常量) 1、const只可用于基元类型、枚举、字符串,而readonly则可以是任何的类型; 2、const在编译时将替换成具体的常量,这样如果在引用中同时使用了const和readonly两种值,则对readonly的再次改变将会改变设计的初衷,这是需要重新编译所更改的程序集,以重新引用新的常量值。 3、const比readonly效率高,但失去了应用的灵活性。 三、...
阅读全文
摘要:Let me start by saying that the idea I used in this article is not originally mine, but since I have only heard of it and have not been able to find any actual examples of its implementation anywhere I wrote the code to handle it.With that out of the way - here's what this is about: Anyone who&#
阅读全文