0

Hi guys I have a Class Library program wich is part of a platform called genesys (WPF who calls the DLL that I'm editing), that executes many DLLs, I want to run a method just before the aplication call the others DLLs, I was trying with things like

void startu(object sender, StartupEventArgs e){
//some stuff
}

it's even possible that I can catch the main run of the class libary? or there's a form to know wich class is the main who run the library?

  • Class library itself does not trigger, You can call class library method from other running application like console, winform, wpf, or asp.net, etc. – Akash KC Nov 22 '17 at 00:33
  • there is a mechanism in Windows dynamic library linking ([DllMain](https://msdn.microsoft.com/en-us/library/windows/desktop/ms682583(v=vs.85).aspx)) but this is not exposed in .NET runtime. – Cee McSharpface Nov 22 '17 at 00:36
  • What about [this](https://stackoverflow.com/questions/8987159/which-preapplicationstartmethod-should-i-use)? – ProgrammingLlama Nov 22 '17 at 02:01
  • Thanks dude but the main code is a WPF application Im just editing a part of that who is in a Class library! – DanielUltramar Nov 22 '17 at 17:40
  • @AkashKC actually the application does, but how can I know wich is the first class that the WPF touch of the Class library! – DanielUltramar Nov 22 '17 at 17:45
  • Related or also duplicate: [Initialize library on Assembly load](https://stackoverflow.com/q/459560/3744182) and [Module initializers in C#](https://stackoverflow.com/q/1915506/3744182). Alternatively [static constructors](https://stackoverflow.com/q/4506990/3744182) for specific type(s) in your assembly might meet your needs in practice. – dbc Nov 22 '17 at 18:14

0 Answers0