Ray's playground

 

2011年1月27日

Item 18: Distinguish Between Value Types and Reference Types(Effective C#)

摘要: Build low-level data storage types as value types. Build the behavior ofyour application using reference types. You get the safety of copying datathat gets exported from your class objects. You get the memory usage benefitsthat come with stack-based and inline value storage, and you can utilizestand 阅读全文

posted @ 2011-01-27 23:16 Ray Z 阅读(200) 评论(0) 推荐(0) 编辑

Item 17: Implement the Standard Dispose Pattern(Effective C#)

摘要: The implementation of your IDisposable.Dispose() method is responsiblefor four tasks:  1. Freeing all unmanaged resources.  2. Freeing all managed resources (this includes unhooking events).  3. Setting a state flag to indicate that the object has been disposed. Youneed to check this state and throw 阅读全文

posted @ 2011-01-27 23:10 Ray Z 阅读(158) 评论(0) 推荐(0) 编辑

导航