Disposing Brushes
.net, c#, system.drawing, winforms
Solution
I am not entirely certain, but I don't believe it is. This would be safer:
using(var redBrush = new SolidBrush(Color.Red)
{
g.DrawString(valueText, Font, redBrush);
}
Problem
I am having a few memory problems with a long running application; I have been inspecting the paint methods to insure that brushes are properly disposed. In the case where the `Brush` is created in the argument to the function, will the brush be disposed after the call? The case is outlined below: ``` g.DrawString(valueText, Font, new SolidBrush(Color.Red), ```