[2.0] Self-destructing class?
Is it possible for a class to essentially set itself to null? I need someway to run a function on a class and have it terminate right after.
Running into infinite loop problem, and I figured out why.. i need to destroy the class when i'm done with it.
is it possible?
Re: [2.0] Self-destructing class?
Check out the IDispose interface. It provides a method that you can implement in order to cleanly reclaim all resources used by a class instance. Also see "Destructors" in MSDN.
Re: [2.0] Self-destructing class?
Just set it to null when you're done with it?
Re: [2.0] Self-destructing class?
Quote:
Originally Posted by MasterEvilAce
Is it possible for a class to essentially set itself to null? I need someway to run a function on a class and have it terminate right after.
Running into infinite loop problem, and I figured out why.. i need to destroy the class when i'm done with it.
is it possible?
Implement IDisposable interface and use your class with "using" keyword