Friday, April 18, 2008

How do I use the 'using' keyword with multiple objects?

You can nest using statements, like this:
using( obj1 )
{
using( obj2 )
{
...
}
}
However consider using this more aesthetically pleasing (but functionally identical) formatting:
using( obj1 )
using( obj2 )
{
...
}

No comments: