Dispose() in Partial Class

G

Guest

I have been migrating my code from .NET 1.1 framework to .NET 2.0 framework.
With the designer generated code, the Dispose() method is put in the
<Name>.Designer.cs partial class.
How is it possible to add resource cleanup code to a user control/form (as I
used to do in the Dispose() method before partial classes)?

Many thanks.
 
N

Nicholas Paldino [.NET/C# MVP]

James,

You can always register for the Disposed event. This event is called
only when the Dispose method is called, not when an object is finalized.
You can call Dispose on your resources there.

Hope this helps.
 

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

Top