user control dispose never fires

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

Guest

vs2003 c# cf v1.0.5000
ive created a user control and it works wonderfully however, the dispose
method never fires. searched around, didnt see anything...

any ideas as to why it wouldnt fire, i have code in there that needs to
execute?
 
Dispose fires when the garbage collector runs. And you can't ever tell when
that may be. A minute after your object goes out of scope, or an hour, or a
day.

If you need it to get called right away, call Dipose yourself
 
thank you marina...
thats a nice feature...

Marina said:
Dispose fires when the garbage collector runs. And you can't ever tell when
that may be. A minute after your object goes out of scope, or an hour, or a
day.

If you need it to get called right away, call Dipose yourself
 
The irony is not really appropriate. The IDisposable interface is designed
so that users of the object can PROGRAMATICALLY control when resources are
freed.

If you are worried only about the garbage collector, write a finalizer.

Hector
 

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