Peter,

>I will often use the try ... finally pattern in C# if there is more than one
>type of resource to clean up. The using statement only supports one type at
>a time.

Yes, but you can easily nest them

using ( DisposableType1 d1 = new DisposableType1() )
using ( DisposableType2 d2 = new DisposableType2() )
using ( DisposableType3 d3 = new DisposableType3() ) {
   // ...
}

or

using ( IDisposable d1 = new DisposableType1(), d2 = new DisposableType2() ) {
   DisposableType1 dt1 = d1 as DisposableType1;
   DisposableType2 dt2 = d2 as DisposableType2;
   // ...
}


Mattias

===
Mattias Sjögren
[EMAIL PROTECTED]

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to