You can pass an array of objects that match the target constructor's signature. DEV Community Type personType = // Matches a constructor: Person(string name, int age) person = Activator.CreateInstance(personType, "John Doe" Use code with caution. Copied to clipboard 3. Generic Version
instance = Activator.CreateInstance(targetType); StringBuilder sb = (StringBuilder)instance; sb.Append( "Hello from Activator!" Use code with caution. Copied to clipboard 2. Instantiating with Parameters activators dotnet 4.6.1
Activators .NET 4.6.1 have several use cases, including: You can pass an array of objects that