I have used the "using" statement in both C# and VB. I agree with all the critics regarding nesting using statements (C# seems well done, VB not so much)
So with that in mind I was interested in improving my VB using statements by "using" more than one system resource within the same block:
Example:
Using objBitmap as New Bitmap(100,100)
Using objGraphics as Graphics = Graphics.From(objBitmap)
End Using
End Using
Could be Written like this:
Using objBitmap as New Bitmap(100,100), objGraphics as Gaphics = Graphics.FromImage(objbitmap)
End Using
So my question is what is the better method?
My gut tells me that if the resources are related/dependent then using more than one resource in a using statement is logical.
I have searched so and google for discussions/opinions on this with no luck so I am looking to our experts here to help me sift this question out. Thanks!