Skip to content

Instantly share code, notes, and snippets.

@joshgo
Created March 28, 2014 15:04
Show Gist options
  • Save joshgo/9834898 to your computer and use it in GitHub Desktop.
Save joshgo/9834898 to your computer and use it in GitHub Desktop.
Dynamically load an assembly, and call the static constructor of a specific class.
private static void LoadAndInit(string assemblyPath, string className)
{
var assembly = System.Reflection.Assembly.LoadFile(assemblyPath);
RuntimeHelpers.RunClassConstructor(assembly.GetType(className).TypeHandle);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment