- The used block will get rid of OdbcConnection.
- Normal scope rules work for everything that is declared inside a use block.
- IDisposable.
. using # .
, () , , . , . .
[]
: , :
using (Bitmap b1 = new Bitmap("file1"), b2 = new Bitmap("file2"))
{ ... }
, , , for
if
. . , .
using(Bitmap b = new Bitmap("filex"))
using(Graphics g = Graphics.FromImage(b))
{
}
error CS1044: Cannot use more than one type in a for, using, fixed, or declaration statement.
using(Bitmap b = new Bitmap("filex"), Graphics g = Graphics.FromImage(b))