Type myType = typeof (UserAccount); object [] args = "John Doe" , 30 ; object user = Activator.CreateInstance(myType, args); Use code with caution. Copied to clipboard
: A generic version that returns an instance of T . Note that T must have a public parameterless constructor. Common Use Cases in .NET 4.6.1 1. Plugin Architectures activators dotnet 4.6.1
Type myType = typeof (UserAccount); object [] args = "John Doe" , 30 ; object user = Activator.CreateInstance(myType, args); Use code with caution. Copied to clipboard
: A generic version that returns an instance of T . Note that T must have a public parameterless constructor. Common Use Cases in .NET 4.6.1 1. Plugin Architectures