G
Guest
Hi,
I am developing a C# control for my own use that will be used lots of times
on a form. It's inherited direct from Control, so I am doing all the drawing
myself... and as there are lots of possible 'bells and whistles' that each
control may use, there are lots of brushes, pens, fonts etc that I want to
optimise the use of. In other words, lots of unmanaged resources that need
to be Disposed after use.
The main optimisation that I wanted to do was to make these items STATIC.
This should be a great thing to do because then I have one initialisation of
each of these things, instead of potentially hundreds.
The trouble is, where would I then safely dispose of these items? The
'standard dispose mechanism' is well documented for instance variables, but
as far as I can tell there is no sure way to manage disposal of anything
declared static... or can I rely on .NET to correctly free such windows
resources when the program is closed?
Can anyone help?
Nij
I am developing a C# control for my own use that will be used lots of times
on a form. It's inherited direct from Control, so I am doing all the drawing
myself... and as there are lots of possible 'bells and whistles' that each
control may use, there are lots of brushes, pens, fonts etc that I want to
optimise the use of. In other words, lots of unmanaged resources that need
to be Disposed after use.
The main optimisation that I wanted to do was to make these items STATIC.
This should be a great thing to do because then I have one initialisation of
each of these things, instead of potentially hundreds.
The trouble is, where would I then safely dispose of these items? The
'standard dispose mechanism' is well documented for instance variables, but
as far as I can tell there is no sure way to manage disposal of anything
declared static... or can I rely on .NET to correctly free such windows
resources when the program is closed?
Can anyone help?
Nij