Files
Firebird_2D/LoadDynamic and inject dependency.txt

11 lines
390 B
Plaintext

Assembly assembly = Assembly.LoadFrom("plugin.dll");
Type pluginType = assembly.GetTypes().First(t => typeof(IPlugin).IsAssignableFrom(t));
ConstructorInfo ctor = pluginType.GetConstructor(new[] { typeof(IEventBus) });
if (ctor == null)
throw new InvalidOperationException("Kein passender Konstruktor gefunden.");
IPlugin instance = (IPlugin)ctor.Invoke(new object[] { eventBus });