daveamour
asked on
Dispose
When I write classes in C# then implement them as follows:
ETrainingDemo.Classes.News LetterReci pient objRecipient = new ETrainingDemo.Classes.News LetterReci pient();
objRecipient.Firstname = Firstname.Text;
objRecipient.Surname = Surname.Text;
objRecipient.Email = Email.Text;
objRecipient.Add()
If I want to kill the object straight away rather than relying on the garbage collector, what is the best way to do this. Is there a command like Set object = Nothing? Should I build dispose code into my class, should I inherit a Dispose Interface?
Any thoughts, ideas please?
Thanks
Dave
ETrainingDemo.Classes.News
objRecipient.Firstname = Firstname.Text;
objRecipient.Surname = Surname.Text;
objRecipient.Email = Email.Text;
objRecipient.Add()
If I want to kill the object straight away rather than relying on the garbage collector, what is the best way to do this. Is there a command like Set object = Nothing? Should I build dispose code into my class, should I inherit a Dispose Interface?
Any thoughts, ideas please?
Thanks
Dave
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry for confusing...
Not really overriding it. Just implement the destructor like this would do it:
~NewsLetterRecipient()
{
Dispose();
}
Regards.
Not really overriding it. Just implement the destructor like this would do it:
~NewsLetterRecipient()
{
Dispose();
}
Regards.
ASKER
Ok, thanks very much :)
ASKER
Thanks
Dave