internal static object InvokeConstructorCallSite(Type type, bool isValueType, object[] args, string[] argNames, ref CallSite callSite) { LazyBinder tBinder = null; Type tBinderType = typeof(InvokeConstructorDummy); if (callSite == null || isValueType) { if (isValueType && args.Length == 0) //dynamic invocation doesn't see no argument constructors of value types { return(Activator.CreateInstance(type)); } tBinder = () => { var tList = GetBindingArgumentList(args, argNames, true); return(Binder.InvokeConstructor(CSharpBinderFlags.None, type, tList)); }; } if (isValueType || Util.IsMono) { CallSite tDummy = null; return(DynamicInvokeStaticMember(type, ref tDummy, tBinderType, KnownConstructor, tBinder, ConstructorName, true, type, argNames, type, args)); } return(InvokeMemberTargetType <Type, object>(ref callSite, tBinderType, KnownConstructor, tBinder, ConstructorName, true, type, argNames, type, args)); }
internal static object InvokeConstructorCallSite(Type type, bool isValueType, object[] arguments, string[] argumentNames, Type context, ref CallSite callSite) { LazyBinder binder = null; Type binderType = typeof(InvokeConstructorDummy); if (callSite == null || isValueType) { if (isValueType && arguments.Length == 0) //dynamic invocation doesn't see no argument constructors of value types { return(Activator.CreateInstance(type)); } binder = () => { var tList = GetBindingArgumentList(arguments, argumentNames, true); return(Binder.InvokeConstructor(CSharpBinderFlags.None, type, tList)); }; } if (isValueType || TypeFactorization.IsMonoRuntimeEnvironment) { CallSite dummyCallSite = null; return(DynamicInvokeStaticMember(type, ref dummyCallSite, binderType, binder, Invocation.ConstructorBinderName, true, type, argumentNames, type, arguments)); } return(MemberTargetTypeInvoke <Type, object>(ref callSite, binderType, binder, Invocation.ConstructorBinderName, true, type, argumentNames, type, arguments)); }