C
Carl Johansson
Except for the syntax, what is the difference, if any, between this...
/* ---------------------------------------------------------------------- */
private void Form1_Paint(object sender, PaintEventArgs e)
{
Pen pen = null;
try
{
pen = new Pen(Color.MidnightBlue, 1.0F);
e.Graphics.DrawLine(pen, new Point(20, 270), new Point(20, 10));
}
finally
{
if (pen != null)
pen.Dispose();
}
}
/* ---------------------------------------------------------------------- */
and this...
/* ---------------------------------------------------------------------- */
private void Form1_Paint(object sender, PaintEventArgs e)
{
using (Pen pen = new Pen(Color.MidnightBlue, 1.0F))
e.Graphics.DrawLine(pen, new Point(20, 270), new Point(20, 10));
}
/* ---------------------------------------------------------------------- */
?
Regards Carl Johansson
/* ---------------------------------------------------------------------- */
private void Form1_Paint(object sender, PaintEventArgs e)
{
Pen pen = null;
try
{
pen = new Pen(Color.MidnightBlue, 1.0F);
e.Graphics.DrawLine(pen, new Point(20, 270), new Point(20, 10));
}
finally
{
if (pen != null)
pen.Dispose();
}
}
/* ---------------------------------------------------------------------- */
and this...
/* ---------------------------------------------------------------------- */
private void Form1_Paint(object sender, PaintEventArgs e)
{
using (Pen pen = new Pen(Color.MidnightBlue, 1.0F))
e.Graphics.DrawLine(pen, new Point(20, 270), new Point(20, 10));
}
/* ---------------------------------------------------------------------- */
?
Regards Carl Johansson