Re: dynamic class loading

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Richard Blewett [DevelopMentor] (richardb_at_NOSPAMdevelop.com)
Date: 03/26/05


To: microsoft.public.dotnet.languages.csharp
Date: Sat, 26 Mar 2005 02:21:08 -0800

Assembly a = Assembly.LoadFrom(<codebase of assembly>);
 foreach( Type t in a.GetTypes() )
 {
 if( a.IsClass )
 {
 // Do stuff to class such as
 object o = a.CreateInstance(t.FullName);
 }
 }

 Obviously if you are interested in all types not just classes you can omit the if.

 Regards

 Richard Blewett - DevelopMentor
 http://www.dotnetconsult.co.uk/weblog
 http://www.dotnetconsult.co.uk

   Hi all,
 
 If someone has compiled a dll for the some classes,
 and I want to use the dll in another project, how can I know the class
 available in that dll file?
 
 Thanks!
 



Relevant Pages

  • Re: Suggestion regarding reflexion and dynamic load of controls
    ... static void GetModules() ... foreach ... implemented into a dll? ... implement a specific interface, I need to be able to load that class ...
    (microsoft.public.dotnet.csharp.general)
  • wrong ELF class:
    ... Your "cron" job on sun105z3 ... install_driverfailed: Can't load ... Perhaps a required shared library or dll isn't installed where expected ... foreach $p { ...
    (perl.dbi.users)
  • Re: COM DLL version info
    ... I need to print out the version info on every DLL for ... foreach (ProcessModule pm in Process.GetCurrentProcess().Modules) ... Of course not all modules loaded will be COM servers so you may have ...
    (microsoft.public.dotnet.framework.interop)
  • Re: ASP.NET Security
    ... Dominick Baier - DevelopMentor ... the CLR to turn off all security checks... ... The easiest quickest simplest solution is to not use a .dll - just ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • DLL / Update without restarting Web Service?
    ... I have setup a website which uses an old DLL file ... this update WITHOUT resetting the W3SVC service. ... Is there a way to us the Delphi DLL as a COM or COM+ component? ...
    (microsoft.public.inetserver.iis)