I want to initialize my C# library as it loads by another process, is it possible and if so - how?
+6
A:
No.
Instead, you can add a static constructor to your class, which will execute the first time that the class is used.
SLaks
2010-05-30 14:56:57
That's what I'm currently using - wondered if there is something better...
Eran Betzalel
2010-05-30 15:05:13
Why? What' wrong with it?
SLaks
2010-05-30 15:06:32
"execute the first time"... make that "execute *before* the first time *any other member is accessed* ".
Richard
2010-05-30 15:27:25
@SLaks, because it depends on a class rather than the DLL itself, which is fine and working, but not perfect, not as it suppose to work.
Eran Betzalel
2010-05-30 22:14:03