Activators Dotnet 4.6.1 High Quality
Type myType = typeof(List<int>); object instance = Activator.CreateInstance(myType); List<int> list = (List<int>)instance;
For extreme performance requirements, consider using System.Reflection.Emit to generate a delegate that calls the constructor, which is faster than Activator . Activator vs. Dependency Injection activators dotnet 4.6.1
, it will generally remain compatible if you upgrade to a supported version like .NET 4.6.2 (supported until Jan 2027) or .NET 4.8.1 (supported indefinitely). Performance : While convenient, Activator.CreateInstance is slower than the operator because it requires reflection to find the correct constructor at runtime. Why use it? Developers often use Activators in .NET 4.6.1 for: Plugin Architectures : Loading third-party files at runtime. Dependency Injection Type myType = typeof(List<