摘要: Item 2: Prefer readonly to const 第2项: 定义常量时,优先使用readonly,而不是const在C#中存在两种定义常量的方法。第一种是编译时(compile-time)的常量,一种是运行时(Runtime)的常量。 编译时常量:public const int year= 2005;(使用const关键字) 运行时常量:public static readon... 阅读全文
posted @ 2005-08-07 20:34 jierry 阅读(1404) 评论(7) 推荐(0) 编辑
摘要: Bill Wagner先生的《Effective C#》一书保持作者一贯的风格,很值得我们一读。很早就想把读此书的感想写出来,一直没有时间,最近总算比较轻闲,借此写出读此书的心得,水平有限,希望对大家有所帮助 Item 1: Always Use Properties Instead of Accessible Data Members 第一项:永远使用属性而不要直接访问数据成员 说到属性,... 阅读全文
posted @ 2005-08-07 00:15 jierry 阅读(1418) 评论(10) 推荐(0) 编辑