public static NewExpression New(Type type, string constructorName, object arguments) { var result = GetParametersAndArguments(arguments); ConstructorInfo constructorInfo = null; try { constructorInfo = type.GetConstructor(result.Item1.Select(c => c.ParameterType).ToArray()); } catch { } if (constructorInfo == null || constructorInfo is FickleConstructorInfo) { constructorInfo = new FickleConstructorInfo(type, constructorName, result.Item1); } return(Expression.New(constructorInfo, result.Item2)); }
public static NewExpression New(Type type, string constructorName, object arguments) { var result = GetParametersAndArguments(arguments); ConstructorInfo constructorInfo = null; try { constructorInfo = type.GetConstructor(result.Item1.Select(c => c.ParameterType).ToArray()); } catch { } if (constructorInfo == null || constructorInfo is FickleConstructorInfo) { constructorInfo = new FickleConstructorInfo(type, constructorName, result.Item1); } return Expression.New(constructorInfo, result.Item2); }