internal object Invoke(object obj, System.Reflection.BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture, bool skipVisibilityChecks) { int length = this.Signature.Arguments.Length; int num2 = (parameters != null) ? parameters.Length : 0; if ((this.m_invocationFlags & 1) == 0) { this.m_invocationFlags = this.GetOneTimeFlags(); } if ((this.m_invocationFlags & 2) != 0) { this.ThrowNoInvokeException(); } this.CheckConsistency(obj); if (length != num2) { throw new TargetParameterCountException(Environment.GetResourceString("Arg_ParmCnt")); } if (num2 > 0xffff) { throw new TargetParameterCountException(Environment.GetResourceString("NotSupported_TooManyArgs")); } if (!skipVisibilityChecks && ((this.m_invocationFlags & 0x24) != 0)) { if ((this.m_invocationFlags & 0x20) != 0) { CodeAccessPermission.DemandInternal(PermissionType.ReflectionMemberAccess); } if ((this.m_invocationFlags & 4) != 0) { MethodBase.PerformSecurityCheck(obj, this.m_handle, this.m_declaringType.TypeHandle.Value, this.m_invocationFlags); } } RuntimeTypeHandle emptyHandle = RuntimeTypeHandle.EmptyHandle; if (!this.m_reflectedTypeCache.IsGlobal) { emptyHandle = this.m_declaringType.TypeHandle; } if (num2 == 0) { return(this.m_handle.InvokeMethodFast(obj, null, this.Signature, this.m_methodAttributes, emptyHandle)); } object[] arguments = base.CheckArguments(parameters, binder, invokeAttr, culture, this.Signature); object obj2 = this.m_handle.InvokeMethodFast(obj, arguments, this.Signature, this.m_methodAttributes, emptyHandle); for (int i = 0; i < num2; i++) { parameters[i] = arguments[i]; } return(obj2); }
public override object Invoke(System.Reflection.BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { RuntimeTypeHandle typeHandle = this.m_declaringType.TypeHandle; if (this.m_invocationFlags == 0) { this.m_invocationFlags = this.GetOneTimeFlags(); } if ((this.m_invocationFlags & 0x10a) != 0) { this.ThrowNoInvokeException(); } if ((this.m_invocationFlags & 0xa4) != 0) { if ((this.m_invocationFlags & 0x20) != 0) { CodeAccessPermission.DemandInternal(PermissionType.ReflectionMemberAccess); } if ((this.m_invocationFlags & 4) != 0) { MethodBase.PerformSecurityCheck(null, this.m_handle, this.m_declaringType.TypeHandle.Value, this.m_invocationFlags & 0x10000000); } if ((this.m_invocationFlags & 0x80) != 0) { new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand(); } } int length = this.Signature.Arguments.Length; int num2 = (parameters != null) ? parameters.Length : 0; if (length != num2) { throw new TargetParameterCountException(Environment.GetResourceString("Arg_ParmCnt")); } RuntimeHelpers.RunClassConstructor(typeHandle); if (num2 <= 0) { return(this.m_handle.InvokeConstructor(null, (SignatureStruct)this.Signature, typeHandle)); } object[] args = base.CheckArguments(parameters, binder, invokeAttr, culture, this.Signature); object obj2 = this.m_handle.InvokeConstructor(args, (SignatureStruct)this.Signature, typeHandle); for (int i = 0; i < num2; i++) { parameters[i] = args[i]; } return(obj2); }
public override object Invoke(object obj, System.Reflection.BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture) { if (this.m_invocationFlags == 0) { this.m_invocationFlags = this.GetOneTimeFlags(); } if ((this.m_invocationFlags & 2) != 0) { this.ThrowNoInvokeException(); } this.CheckConsistency(obj); if (obj != null) { new SecurityPermission(SecurityPermissionFlag.SkipVerification).Demand(); } if ((this.m_invocationFlags & 0x24) != 0) { if ((this.m_invocationFlags & 0x20) != 0) { CodeAccessPermission.DemandInternal(PermissionType.ReflectionMemberAccess); } if ((this.m_invocationFlags & 4) != 0) { MethodBase.PerformSecurityCheck(obj, this.m_handle, this.m_declaringType.TypeHandle.Value, this.m_invocationFlags); } } int length = this.Signature.Arguments.Length; int num2 = (parameters != null) ? parameters.Length : 0; if (length != num2) { throw new TargetParameterCountException(Environment.GetResourceString("Arg_ParmCnt")); } if (num2 <= 0) { return(this.m_handle.InvokeMethodFast(obj, null, this.Signature, this.m_methodAttributes, (this.DeclaringType != null) ? this.DeclaringType.TypeHandle : RuntimeTypeHandle.EmptyHandle)); } object[] arguments = base.CheckArguments(parameters, binder, invokeAttr, culture, this.Signature); object obj2 = this.m_handle.InvokeMethodFast(obj, arguments, this.Signature, this.m_methodAttributes, (this.ReflectedType != null) ? this.ReflectedType.TypeHandle : RuntimeTypeHandle.EmptyHandle); for (int i = 0; i < num2; i++) { parameters[i] = arguments[i]; } return(obj2); }