partial class (designer created) and Dispose override

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
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 
R

Richard Blewett [DevelopMentor]

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
 
L

Lelekács Zoltán

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
 

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