Jozsef Bekes said:
Hi All,
is there a mechanism just like DllMain in VC6, a function that gets called
whenever an assembly gets loaded?
Thank you for all answers.
Jozsi
When you create a new instance of ANY class, the Public Sub New() gets
called. You can override this if needed. You can also implement IDisposable
to call the Dispose() method of your class to tear things down. As far as
one all inclusive method for the entire DLL, there is none. The reason
being, I would suspect, is because DllMain get's called mainly in a Dll
exposing API methods, in which the whole Dll is acted apon, whereas in .NET,
the entire Assambly is loaded, but only the specific class/object you call is
initiated.
o, in closing, put a Sub New() in all your classes, and maybe look into
IDisposable to make your Dll really able to take care of it's resources.
HTH,
Jody