[Tip]Several quick tips (can be classified in future if necessary)

Several Tips:

0. Dispose() requires explicitly called, no matter manually calling it OR putting it into finalizer.

1. 不要override Finalize(),而是提供析构函数。编译器会在IL里把他 编译成Finalize().

2. View C# IL code:IL DASM.

3. In callstack window, RMB click, go to disassembly.

4. In case you want to force a managed class to be destructed by GC, you can make use of weakReference. Calling GC.collect() will get the weakreferenced-object destructed.

posted @ 2011-01-26 16:07  能巴  阅读(187)  评论(0编辑  收藏  举报