title: Dynamically load DLL files in C# project - how?
body: <p>In my project I need to use plugins. But to use these in my project I need to import an reference of the plugin. Since I can't know how many or which plugins the project uses beforehand I would like to import them dynamically in my project.</p>
  
  <pre><code>    String path = Application.StartupPath;
      string[] pluginFiles = Directory.GetFiles(path, "*.dll");
      ipi = new IPlugin[pluginFiles.Length];
      Assembly asm;
  
          for (int i = 0; i &lt; pluginFiles.Length; i++)
          {
              string args = pluginFiles[i].Substring(
                  pluginFiles[i].LastIndexOf("\\") + 1,
                  pluginFiles[i].IndexOf(".dll") -
                  pluginFiles[i].LastIndexOf("\\") - 1);
  
              asm = Assembly.LoadFile(pluginFiles[i]);
              Type[] types = asm.GetTypes();
  </code></pre>
  
  <p>In this code example I searched all the <code>.dll</code> files and put them into a string list.
  But how can I now load all these <code>.dll</code> files? Or is there a way to use these <code>.dll</code> files without really importing them?</p>