✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
public static IGameUIFactory Load(string dll)
{
var asm = Assembly.LoadFrom(dll);
var type = asm.GetTypes()
.First(t => typeof(IGameUIFactory).IsAssignableFrom(t));
return (IGameUIFactory)Activator.CreateInstance(type)!;
}
Чому рефлексивний спосіб менш безпечний?