Activator.CreateInstance with parameters

https://docs.microsoft.com/en-us/dotnet/api/system.activator.createinstance?view=netframework-4.8#System_Activator_CreateInstance_System_Type_System_Object___

public static object CreateInstance (Type type, params object[] args);

可以变参数,只要参数数量,顺序,以及类型和构造函数那边对应上就可以

An array of arguments that match in number, order, and type the parameters of the constructor to invoke. If args is an empty array or null, the constructor that takes no parameters (the default constructor) is invoked.

原文地址:https://www.cnblogs.com/chucklu/p/10936920.html