Ray's playground

 

2011年2月9日

Item 19: Ensure That 0 Is a Valid State for Value Types(Effective C#)

摘要: The system initializes all instances of value types to 0. There is no way toprevent users from creating instances of value types that are all 0s. If possible,make the all 0 case the natural default. As a special case, enums usedas flags should ensure that 0 is the absence of all flags. 阅读全文

posted @ 2011-02-09 21:22 Ray Z 阅读(125) 评论(0) 推荐(0) 编辑

Item 16: Avoid Creating Unnecessary Objects(Effective C#)

摘要: The Garbage Collector does an efficient job of managing the memory thatyour application uses. But remember that creating and destroying heapobjects still takes time. Avoid creating excessive objects; don’t create whatyou don’t need. Also avoid creating multiple objects of referen 阅读全文

posted @ 2011-02-09 21:05 Ray Z 阅读(133) 评论(0) 推荐(0) 编辑

导航