Do you know how to dispose instances?
examples:
|
clGeral is a class created by me, and there is no Dispose method inside because it is a simple class. It just opens SQL Connection, query and return some data, close SQL Connection.
Making Geral = null will solve my problem? class will be destroyed or I need to do anything else?
Another exemple:
|
In this case, DataTable have Dispose method, do I need to use dt = null after dt.Dispose ? Or dt.Dispose is enought?
thanks!
carle laiPosted Feb 3, 2010, 2:09 AM
In MSDN, assigning null is not recommended.If you want more efficient memory,you can try the following code:
xxx = null;
GC.Collect();