
using statement, why just a single type?
This is just a minor annoyance but why is the using statement limited to
creating instances of one type only?
Example:
// Not allowed
using (Type1 t1 = new Type1(), Type2 t2 = new Type2())
{
// do some stuff...
Quote:
}
// Must do this instead
using (Type1 t1 = new Type1())
{
using (Type2 t2 = new Type2())
{
// do some stuff...
}
Quote:
}
I just think the first version is so much easier to read....
/Patrik