/// <summary> /// Invokes the constructor <paramref name="ctorInfo"/> with <paramref name="parameters"/> as arguments. /// Leave <paramref name="parameters"/> empty if the constructor has no argument. /// </summary> public static object CreateInstance(this ConstructorInfo ctorInfo, params object[] parameters) { ConstructorInvoker ctor = ctorInfo.DelegateForCreateInstance(); object value = ctor(parameters); return(value); }
/// <summary> /// Invokes the constructor <paramref name="ctorInfo"/> with <paramref name="parameters"/> as arguments. /// Leave <paramref name="parameters"/> empty if the constructor has no argument. /// </summary> public static object CreateInstance(this ConstructorInfo ctorInfo, params object[] parameters) { return(ctorInfo.DelegateForCreateInstance()(parameters)); }