Using dispose correctly

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

To maintain the memory on my CF device each of my custom classes implements
the IDisposable interface.

When disposing of a form using its dispose method, should all controls and
classes created within that form be disposed off programmatically or is
disposing of the form sufficient?
 
Only implement IDisposable for objects that reference other objects that
expose a Dispose method and/or hold unmanaged resources (e.g. Handles).
Implementing blindly on everything will hurt your perf and add no value.

Disposing a form will dispose its controls (not true for RTM but fixed in
one of the service packs)

Cheers
Daniel
 
Cheers for that Daniel, my board has only the RTM version of CF so I should
dispose of the third party grid control by overriding the dispose method on
the form.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top