Both classes for practicality sake are disposable.
I understand what a using block does. But I'm not sure of all of the ways it can or needs to be used.
For example is this correct?
using (MyClass myClass = new MyClass(params))
{
myClass.name = "Steve";
SecondClass myClassSecond = new SecondClass(params);
myClassSecond.name = "George";
myClassSecond.msg = "Hello Man in the Yellow Hat";
}
Are both classes above disposed of?
Or do I need both inside a using statement?
using (MyClass myClass = new MyClass(params))
{
myClass.name = "Steve";
using (SecondClass myClassSecond = new SecondClass(params))
{
myClassSecond.name = "George";
myClassSecond.msg = "Hello Man in the Yellow Hat";
}
}
Is the above correct, or is there a better way to use multiple using statements?