I used the using statement in both C # and VB. I agree with all the critics regarding nesting using operators (C # looks good, VB is not much)
Therefore, referring to me, I was interested in improving my VB applications, using the "use" of more than one system resource in one block:
Example:
Using objBitmap As New Bitmap(100,100) Using objGraphics as Graphics = Graphics.From(objBitmap) End Using End Using
It could be written like this:
Using objBitmap As New Bitmap(100,100), objGraphics as Gaphics = Graphics.FromImage(objbitmap) End Using
So my question is the best method?
My gut tells me that if resources are related / dependent, then using more than one resource in a using statement is logical.
PersistenceOfVision
source share