Ray's playground

 

2011年1月15日

Item 8: Prefer Query Syntax to Loops(Effective C#)

摘要: C# began as an imperative language. It continues to include all the featuresthat are part of that heritage. It’s natural to reach for the most familiartools at your disposal. However, those tools might not be the best tools.When you find yourself writing any form of a looping construct, ask yourself 阅读全文

posted @ 2011-01-15 10:36 Ray Z 阅读(136) 评论(0) 推荐(0)

Item 7: Understand the Pitfalls of GetHashCode()(Effective C#)

摘要: Summarizing the default behavior, Object.GetHashCode() works correctlyfor reference types, although it does not necessarily generate an efficientdistribution. (If you have overridden Object.operator==(), you can breakGetHashCode()). ValueType.GetHashCode() works only if the first field inyour struct 阅读全文

posted @ 2011-01-15 10:12 Ray Z 阅读(204) 评论(0) 推荐(0)

导航