When I want to invoke Dispose() automatically on an object, I can use
using(object)
{
//do something with object
}
and after the closing brace the object is Disposed(). But what get
disposed when I use code like this
override protected void OnPaint(PaintEv entArgs e)
{
using(e.Graphic s.Clip=GetMyCus tomRegion())
{
e.Graphics.Draw Image(bitmap,0, 0);
}
}
Is the Region object returned by GetMyCustomRegi on() succesfully
Disposed()? How does it influence the Clip-property of the Graphics object?
Also, can I nest 'using' statement like this:
override protected void OnPaint(PaintEv entArgs e)
{
using(e.Graphic s.Clip=GetMyCus tomRegion())
using(Bitmap bitmap=new Bitmap(34,55))
{
e.Graphics.Draw Image(bitmap,0, 0);
}
}
Do both the implicit Region object and the Bitmap object get Disposed()?
using(object)
{
//do something with object
}
and after the closing brace the object is Disposed(). But what get
disposed when I use code like this
override protected void OnPaint(PaintEv entArgs e)
{
using(e.Graphic s.Clip=GetMyCus tomRegion())
{
e.Graphics.Draw Image(bitmap,0, 0);
}
}
Is the Region object returned by GetMyCustomRegi on() succesfully
Disposed()? How does it influence the Clip-property of the Graphics object?
Also, can I nest 'using' statement like this:
override protected void OnPaint(PaintEv entArgs e)
{
using(e.Graphic s.Clip=GetMyCus tomRegion())
using(Bitmap bitmap=new Bitmap(34,55))
{
e.Graphics.Draw Image(bitmap,0, 0);
}
}
Do both the implicit Region object and the Bitmap object get Disposed()?
Comment