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.
 
Back
Top