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. Can I automate this?
Submitted by: AdministratorYes, 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
Submitted by: Administrator
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
Submitted by: Administrator
Read Online Dot Net Job Interview Questions And Answers
Top Dot Net Questions
| ☺ | How do you trigger the Paint event in System.Drawing? |
| ☺ | what is the difference between user control an custom control? advantages/disadvantages? |
| ☺ | When we go for html server controls and when we go for web server controls? |
| ☺ | Explain webFarm Vs webGardens in .NET? |
| ☺ | Using COM Component in .Net? |
Top Dot Net Technologies Categories
| ☺ | MSF Interview Questions. |
| ☺ | .Net Architecture Interview Questions. |
| ☺ | ASP.Net MVC Interview Questions. |
| ☺ | Entity Framework Interview Questions. |
| ☺ | C# (Sharp) Programming Language Interview Questions. |
