C# Programming
06-25-2009, 10:10 PM
How does this:
using (MyObj myObj = new MyObj(); ) {
myObj.DoSomething();
}
differ from this?:
{
MyObj myObj = new MyObj();
myObj.DoSomething();
}
I have been using the latter and I'm just wondering if it is more correct to use the former?
using (MyObj myObj = new MyObj(); ) {
myObj.DoSomething();
}
differ from this?:
{
MyObj myObj = new MyObj();
myObj.DoSomething();
}
I have been using the latter and I'm just wondering if it is more correct to use the former?