Effective C#[转自愚翁]

来源:互联网 发布:北京网络综合布线 编辑:程序博客网 时间:2024/04/27 21:12

 第一部分是语言使用的基础,而这是使用语言的基本功,也是平常最不注意的,养成好的习惯,有利于后期水平提高。

这部分包括11个单元,分别如下:
Item 1: Always Use Properties Instead of Accessible Data Members
《Effective C#》Item 1:用属性来访问类的私有成员
http://blog.csdn.net/knight94/archive/2006/06/04/772886.aspx

Item 2: Prefer readonly to const
《Effective C#》Item 2:定义常量的两种方法
http://blog.csdn.net/knight94/archive/2006/06/06/776548.aspx

Item 3: Prefer the is or as Operators to Casts
《Effective C#》Item 3:使用as和is操作符来做类型转换
http://blog.csdn.net/knight94/archive/2006/06/12/791850.aspx

Item 4: Use Conditional Attributes Instead of #if
《Effective C#》Item 4:使用Conditional属性来代替IF/ENDIF程序块
http://blog.csdn.net/knight94/archive/2006/06/18/809479.aspx

Item 5: Always Provide ToString()
《Effective C#》Item 5:提供一个有意义的ToString函数
http://blog.csdn.net/knight94/archive/2006/06/18/810467.aspx

Item 6: Distinguish Between Value Types and Reference Types
《Effective C#》Item 6:区分值类型和引用类型
http://blog.csdn.net/knight94/archive/2006/07/01/861383.aspx

Item 7: Prefer Immutable Atomic Value Types
《Effective C#》Item 7:推荐使用不可改变的原子值类型
http://blog.csdn.net/knight94/archive/2006/07/27/985552.aspx

Item 8: Ensure That 0 Is a Valid State for Value Types
《Effective C#》Item 8:确保"0"在值类型中是有效的
http://blog.csdn.net/knight94/archive/2006/08/09/1040766.aspx

Item 9: Understand the Relationships Among ReferenceEquals(), static Equals(),
instance Equals(), and operator==
《Effective C#》Item 9:区别和认识四个判等函数
http://blog.csdn.net/knight94/archive/2006/08/11/1050901.aspx
   
Item 10: Understand the Pitfalls of GetHashCode()
《Effective C#》Item 10:小心GetHashCode函数所存在的陷阱
http://blog.csdn.net/knight94/archive/2006/08/20/1100194.aspx

Item 11: Prefer foreach Loops
《Effective C#》Item 11:提倡使用foreach语句来进行循环操作
http://blog.csdn.net/knight94/archive/2006/08/20/1100236.aspx