Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
I am constantly writing the drawing procedures with System.Drawing.Graphics, but having to use the try and dispose blocks is to
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?
✍: Guest
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
2013-11-20, 1881👍, 0💬
Popular Posts:
How To Get the Last ID Assigned by MySQL? - MySQL FAQs - Managing Tables and Running Queries with PH...
What is the difference between Session State and ViewState? ViewState is specific to a page in a ses...
Where are all .NET Collection classes located ? System.Collection namespace has all the collection c...
How many types of validation controls are provided by ASP.NET ? There are six main types of validati...
How can a servlet refresh automatically if some new data has entered the database? You can use a cli...