Z
Zytan
I know two possible ways:
1. Use AppDomain.DomainUnload Event
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemAppDomainClassDomainUnloadTopic.asp
which is kinda like Turbo Pascal, which the desinger of C# made, did
it.
2. Use a hack. Make the class non-static, even though it will have no
non-static methods, declare a static field of the class itself:
static private MyClass m_instance;
Then instantiate it in the static constructor:
m_instance = new MyClass();
So, then, you can make a destructor, which should be called only when
the m_instance is on the way out, which should be after no other uses
of the class's static methods are used.
Any comments on which is better?
Zytan
1. Use AppDomain.DomainUnload Event
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemAppDomainClassDomainUnloadTopic.asp
which is kinda like Turbo Pascal, which the desinger of C# made, did
it.
2. Use a hack. Make the class non-static, even though it will have no
non-static methods, declare a static field of the class itself:
static private MyClass m_instance;
Then instantiate it in the static constructor:
m_instance = new MyClass();
So, then, you can make a destructor, which should be called only when
the m_instance is on the way out, which should be after no other uses
of the class's static methods are used.
Any comments on which is better?
Zytan