I am currently writing a fairly sophisticated drawing method for a user control that includes a fair amount of drawing code. I know that all GDI + resources must be correctly located, so I wrap each of them in a block using.
But when I noticed that I used three blocks usingfor three different ones SolidBrushes, I wondered if I could just reuse them. Create SolidBrush, draw with it, assign a different color, draw something else, etc. And put Dispose()an end to it.
Is such a thing appropriate or am I thinking too much here? I don’t really like too many blocks usingnested in each other. While a good sample, it interferes with readability from time to time.
source
share