partial class (designer created) and Dispose override

  • Thread starter Thread starter Lelekács Zoltán
  • Start date Start date
L

Lelekács Zoltán

Hi,

I would like to use a thread together with an object.
In the constructor of the object I create the thread and I would like to
dispose in the Dispose method of the object, but it is already defined of
the designer created partial class of the object.
What is the nice solution to dispose the thread? Can I modify the overrided
method in the designer created partial class?

lelez
 
Lelekács,

You should be able to modify that file. The implementation of Dispose
falls outside of the region for windows forms designer generated code.

Hope this helps.
 
Lelekács Zoltán said:
Hi,

I would like to use a thread together with an object.
In the constructor of the object I create the thread and I would like to
dispose in the Dispose method of the object, but it is already defined of
the designer created partial class of the object.
What is the nice solution to dispose the thread? Can I modify the
overrided method in the designer created partial class?

lelez

The thread class doesn't implement IDisposable - what do you want to do to
the thread, halt it?

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk
 
Yes, but the question was about Dispose method generaly.
It's a little bit strange for me to add a language element to C# to separate
the "generated" and the "edited" code, and after it I have to modify the
generated code... Not nice...I think...

For me the "old fashioned way" was nicer when there was no partial word. Now
I have to keep in mind that some code in a separated file...

lelez
 
Back
Top