c# - How do I extend a WinForm's Dispose method? -


I am getting this warning from FxCop:

"included in the 'restart form' field The 'restart form .done' is of the IDisposable type: 'ManualResetEvent'. Change the displacement method to 'RestartForm' to call this field on or off. "

OK, I understand I mean what it means and why it needs to be done ... except System.Windows.Forms.Form does not allow you to override . Close () or . Settlement () , then what to do? Currently I am running with this solution:

  Private Zero RestartForm_FormClosing (Object Sender, FormClosingEventArgs e) {done.Set (); Done.Close (); }  

Which works as for my application ... but FxCop still shows this message. Am I covered and can I safely ignore it, or should I have another way of doing it?

You override dissection method to form Usually

Usually this automatically overrides in restartform.domain.cs file, so you will need to move to settle in your code file so you can add it without the designer writing it again You can add whatever code you want to add.

In RestartForm.cs

  safe override zero disposing {if (disposing) {if (components! = Null) {components.Dispose (); } // Remove the stuff here} base. Disposal; }  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -