This is a general .NET question, but I provided C# code.
If I have an object that implements IDisposable and I call the .Dispose method, should I also set the object to null? I know about the benefits the "using" keyword, so no need to explain it.
Ex:
Should I do this...
...or...Code:SqlCommand cmd = new SqlCommand(); ...do stuff with command here.... cmd.Dispose(); cmd = null;
...or...Code:SqlCommand cmd = new SqlCommand(); ...do stuff with command here.... cmd.Dispose();
Thanks in advance.Code:SqlCommand cmd = new SqlCommand(); ...do stuff with command here.... cmd = null;
CT




Reply With Quote