Hello,
I'm not against using "Using" statement, but I'm wondering how this affect performance when we use it inside one of another.
For example:
using (test1 (type1))
{
using (test2(type2))
{
using (test2(type3))
{
}
}
}
This, will be translated in IL like this:
try
{
try
{
try
{
}
finally
{
}
}
finally
{
}
}
finally
{
}
This will increase the size of assembly and, I believe, affect the performance of the application, right?
Shouldn't we use this?
type1 test1 = new type1;
type2 test2 = new type2;
type3 test3 = new type3;
try
{
}
finally
{
test1.Dispose;
test2.Dispose;
test3.Dispose;
}