top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Can I automate this?

+1 vote
315 views

I am constantly writing the drawing procedures with System.Drawing.Graphics, but having to use the try and dispose blocks is too time-consuming with Graphics objects.

posted Mar 9, 2014 by Kanika Prashar

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

Yes, the code

System.Drawing.Graphics canvas = new System.Drawing.Graphics();
try
{
//some code
}
finally
canvas.Dispose();

is functionally equivalent to

using (System.Drawing.Graphics canvas = new System.Drawing.Graphics())
{
//some code
} //canvas.Dispose() gets called automatically

answer Mar 9, 2014 by Bhani Bhosle
Similar Questions
+4 votes

How to Automate Web Browser using VB.NET?

0 votes

Before in my VB app I would just load the icons from DLL.

+3 votes

By-default all the methods & variables in class are private.

In C#.net Main() method is private then how compiler access this Main() Method out side the class because compiler is not part of our program then how compiler access this Main() method?

Here we loose our data abstraction property ? Can anyone put some light on it?

...