Eduardo

Eduardo

  • NA
  • 13
  • 16.5k

Disposing and destroying instances

Feb 1 2010 6:16 AM
Hi all,

Do you know how to dispose instances?

examples:

 clGeral Geral = new clGeral();
DataTable dt = new DataTable();
Geral.GetUsers(dt);

Geral = Null;

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:
 DataTable dt = new DataTable();
...
...
...
dt.Dispose();
dt = null;

In this case, DataTable have Dispose method, do I need to use dt = null after dt.Dispose ?  Or dt.Dispose is enought?

thanks!


Answers (1)