L
Larry Serflaten
Can it be known what becomes of the Pen object in a call like:
Me.CreateGraphics().DrawLine(New Pen(Color.Red), 0, 0, 30, 30)
Typically, a Pen object should be disposed, and other objects may
require more significant resources, so I wonder if the pen is left for
the GC to finalize, or are the resources released after the call is
completed?
I am thinking this is such a handy way to pass parameters that the
compiler should be smart enough to know that we don't need the
resources after the call has finished, meaning it's Dispose method
should be 'automatically' called when the method has completed.
Is there any documentation that discusses this type of situation?
LFS
Me.CreateGraphics().DrawLine(New Pen(Color.Red), 0, 0, 30, 30)
Typically, a Pen object should be disposed, and other objects may
require more significant resources, so I wonder if the pen is left for
the GC to finalize, or are the resources released after the call is
completed?
I am thinking this is such a handy way to pass parameters that the
compiler should be smart enough to know that we don't need the
resources after the call has finished, meaning it's Dispose method
should be 'automatically' called when the method has completed.
Is there any documentation that discusses this type of situation?
LFS