We need you! We're working hard on the next version of Developer Fusion -
Let us know what you think we should be up to!
-
Expand
Microsoft.Win32
-
Expand
Microsoft.Win32.SafeHandles
-
Expand
System
-
Expand
System.Runtime.Hosting
-
Expand
System.Runtime.InteropServices
-
Expand
System.Runtime.CompilerServices
-
Expand
System.Collections
-
Expand
System.Collections.Generic
-
Expand
System.Collections.ObjectModel
-
Expand
System.Configuration.Assemblies
-
Expand
System.Diagnostics
-
Expand
System.Diagnostics.CodeAnalysis
-
Expand
System.Diagnostics.SymbolStore
-
Expand
System.Globalization
-
Expand
System.IO
-
Expand
System.IO.IsolatedStorage
-
Expand
System.Reflection
-
Expand
System.Reflection.Cache
-
Expand
System.Reflection.Emit
-
Expand
__ExceptionInfo
-
Expand
__ExceptionInstance
-
Expand
__FixupData
-
Expand
AssemblyBuilder
-
Expand
AssemblyBuilderAccess
-
Expand
AssemblyBuilderData
-
Expand
ConstructorBuilder
-
Expand
ConstructorOnTypeBuilderInstantiation
-
Expand
CustAttr
-
Expand
CustomAttributeBuilder
-
Expand
DestroyScout
-
Expand
DynamicILGenerator
-
Expand
DynamicILInfo
-
Expand
DynamicMethod
-
AsDynamicMethod(MethodBase)
-
Attributes()
-
CallingConvention()
-
CheckConsistency(MethodAttributes, CallingConventions)
-
CreateDelegate(Type)
-
CreateDelegate(Type, object)
-
DeclaringType()
-
DefineParameter(int, ParameterAttributes, string)
-
DynamicMethod()
-
DynamicMethod(string, MethodAttributes, CallingConventions, Type, Type, Module, bool)
-
DynamicMethod(string, MethodAttributes, CallingConventions, Type, Type, Type, bool)
-
DynamicMethod(string, Type, Type, Module)
-
DynamicMethod(string, Type, Type, Module, bool)
-
DynamicMethod(string, Type, Type, Type)
-
DynamicMethod(string, Type, Type, Type, bool)
-
GetBaseDefinition()
-
GetCustomAttributes(bool)
-
GetCustomAttributes(Type, bool)
-
GetDynamicILInfo()
-
GetDynamicILInfo(DynamicScope)
-
GetILGenerator()
-
GetILGenerator(int)
-
GetMethodDescriptor()
-
GetMethodImplementationFlags()
-
GetMethodInfo()
-
GetParameters()
-
Init(string, MethodAttributes, CallingConventions, Type, Type, Type, Module, bool)
-
InitLocals()
-
Invoke(object, BindingFlags, Binder, object, CultureInfo)
-
IsDefined(Type, bool)
-
IsOverloaded()
-
MetadataTokenInternal()
-
MethodHandle()
-
Module()
-
Name()
-
PerformSecurityCheck(Module, StackCrawlMark, bool)
-
PerformSecurityCheck(Type, StackCrawlMark, bool)
-
ReflectedType()
-
ReturnParameter()
-
ReturnType()
-
ReturnTypeCustomAttributes()
-
ToString()
-
Expand
DynamicResolver
-
Expand
DynamicScope
-
Expand
EmptyCAHolder
-
Expand
Entry
-
Expand
EnumBuilder
-
Expand
EventBuilder
-
Expand
EventToken
-
Expand
FieldBuilder
-
Expand
FieldOnTypeBuilderInstantiation
-
Expand
FieldToken
-
Expand
FlowControl
-
Expand
Format
-
Expand
GenericMethodInfo
-
Expand
GenericTypeParameterBuilder
-
Expand
ILGenerator
-
Expand
Label
-
Expand
LineNumberInfo
-
Expand
LocalBuilder
-
Expand
LocalSymInfo
-
Expand
MethodBuilder
-
Expand
MethodBuilderInstantiation
-
Expand
MethodOnTypeBuilderInstantiation
-
Expand
MethodRental
-
Expand
MethodToken
-
Expand
ModuleBuilder
-
Expand
ModuleBuilderData
-
Expand
OpCode
-
Expand
OpCodes
-
Expand
OpCodeType
-
Expand
OperandType
-
Expand
PackingSize
-
Expand
ParameterBuilder
-
Expand
ParameterToken
-
Expand
PEFileKinds
-
Expand
PropertyBuilder
-
Expand
PropertyToken
-
Expand
REDocument
-
Expand
ResWriterData
-
Expand
RTDynamicMethod
-
Expand
ScopeAction
-
Expand
ScopeTree
-
Expand
SecurityControlFlags
-
Expand
SignatureHelper
-
Expand
SignatureToken
-
Expand
StackBehaviour
-
Expand
StringToken
-
Expand
SymbolMethod
-
Expand
SymbolType
-
Expand
SymCustomAttr
-
Expand
TypeBuilder
-
Expand
TypeBuilderInstantiation
-
Expand
TypeKind
-
Expand
TypeNameBuilder
-
Expand
TypeToken
-
Expand
UnmanagedMarshal
-
Expand
VarArgMethod
-
Expand
System.Resources
-
Expand
System.Runtime
-
Expand
System.Runtime.InteropServices.Expando
-
Expand
System.Runtime.ConstrainedExecution
-
Expand
System.Runtime.Remoting.Activation
-
Expand
System.Runtime.Remoting.Messaging
-
Expand
System.Runtime.Remoting.Channels
-
Expand
System.Runtime.Remoting.Lifetime
-
Expand
System.Runtime.Remoting
-
Expand
System.Runtime.Remoting.Contexts
-
Expand
System.Runtime.Remoting.Proxies
-
Expand
System.Runtime.Remoting.Metadata
-
Expand
System.Runtime.Remoting.Metadata.W3cXsd2001
-
Expand
System.Runtime.Remoting.Services
-
Expand
System.Runtime.Serialization
-
Expand
System.Runtime.Serialization.Formatters
-
Expand
System.Runtime.Serialization.Formatters.Binary
-
Expand
System.Runtime.Versioning
-
Expand
System.Security
-
Expand
System.Security.Cryptography
-
Expand
System.Security.Cryptography.X509Certificates
-
Expand
System.Security.Permissions
-
Expand
System.Security.Policy
-
Expand
System.Security.Principal
-
Expand
System.Security.Util
-
Expand
System.Text
-
Expand
System.Threading
-
Expand
System.Runtime.Remoting.Channels.Http
-
Expand
System.Runtime.Remoting.Channels.Tcp
-
Expand
System.Runtime.Remoting.MetadataServices
-
Expand
System.Runtime.Serialization.Formatters.Soap.Xml
-
Expand
System.Runtime.Serialization.Formatters.Soap
-
Expand
Microsoft.Tools.Caspol
-
Expand
Microsoft.Tools.Build
-
Expand
Microsoft.CSharp
-
Expand
System.CodeDom
-
Expand
System.CodeDom.Compiler
-
Expand
System.Collections.Specialized
-
Expand
System.ComponentModel
-
Expand
System.ComponentModel.Design
-
Expand
System.ComponentModel.Design.Serialization
-
Expand
System.Configuration
-
Expand
System.Web
-
Expand
System.Configuration.Provider
-
Expand
System.Configuration.Internal
-
Expand
System.Internal
-
Expand
System.Windows.Forms
-
Expand
System.Net
-
Expand
System.Net.Sockets
-
Expand
System.Net.NetworkInformation
-
Expand
System.Net.ComImports
-
Expand
System.Net.Security
-
Expand
System.Net.Cache
-
Expand
System.Net.Configuration
-
Expand
System.Text.RegularExpressions
-
Expand
System.Tools
-
Expand
System.IO.Compression
-
Expand
System.IO.Ports
-
Expand
System.Security.AccessControl
-
Expand
System.Xml
-
Expand
System.Xml.XPath.DataBinding
-
Expand
System.Xml.Schema
-
Expand
System.Xml.Serialization
-
Expand
System.Xml.Serialization.Advanced
-
Expand
System.Xml.Serialization.Configuration
-
Expand
System.Xml.XPath
-
Expand
System.Xml.Xsl
-
Expand
System.Xml.Xsl.IlGen
-
Expand
System.Xml.Xsl.Qil
-
Expand
System.Xml.Xsl.Runtime
-
Expand
System.Xml.Xsl.XPath
-
Expand
System.Xml.Xsl.Xslt
-
Expand
System.Xml.Xsl.XsltOld
-
Expand
System.Xml.Xsl.XsltOld.Debugger
-
Expand
Microsoft.JScript
-
Expand
Microsoft.Vsa
-
Expand
Microsoft.JScript.Vsa
- namespace System.Reflection.Emit
- {
- using System;
- using CultureInfo = System.Globalization.CultureInfo;
- using System.Reflection;
- using System.Security;
- using System.Security.Permissions;
- using System.Threading;
- using System.Runtime.CompilerServices;
-
- [System.Runtime.InteropServices.ComVisible(true)]
- public sealed class DynamicMethod : MethodInfo
- {
- RuntimeType[] m_parameterTypes;
- RuntimeType m_returnType;
- DynamicILGenerator m_ilGenerator;
- DynamicILInfo m_DynamicILInfo;
- bool m_fInitLocals;
- internal RuntimeMethodHandle m_method;
- internal ModuleHandle m_module;
- internal bool m_skipVisibility;
- internal RuntimeType m_typeOwner;
- RTDynamicMethod m_dynMethod;
-
-
- internal DynamicResolver m_resolver;
-
-
-
-
-
- private DynamicMethod()
- {
- }
-
- public DynamicMethod(string name, Type returnType, Type[] parameterTypes, Module m)
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- DynamicMethod.PerformSecurityCheck(m, ref stackMark, false);
- Init(name, MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, returnType, parameterTypes, null, m, false);
- }
-
- public DynamicMethod(string name, Type returnType, Type[] parameterTypes, Module m, bool skipVisibility)
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- DynamicMethod.PerformSecurityCheck(m, ref stackMark, skipVisibility);
- Init(name, MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, returnType, parameterTypes, null, m, skipVisibility);
- }
-
- public DynamicMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Module m, bool skipVisibility)
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- DynamicMethod.PerformSecurityCheck(m, ref stackMark, skipVisibility);
- Init(name, attributes, callingConvention, returnType, parameterTypes, null, m, skipVisibility);
- }
-
- public DynamicMethod(string name, Type returnType, Type[] parameterTypes, Type owner)
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- DynamicMethod.PerformSecurityCheck(owner, ref stackMark, false);
- Init(name, MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, returnType, parameterTypes, owner, null, false);
- }
-
- public DynamicMethod(string name, Type returnType, Type[] parameterTypes, Type owner, bool skipVisibility)
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- DynamicMethod.PerformSecurityCheck(owner, ref stackMark, skipVisibility);
- Init(name, MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, returnType, parameterTypes, owner, null, skipVisibility);
- }
-
- public DynamicMethod(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Type owner, bool skipVisibility)
- {
- StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
- DynamicMethod.PerformSecurityCheck(owner, ref stackMark, skipVisibility);
- Init(name, attributes, callingConvention, returnType, parameterTypes, owner, null, skipVisibility);
- }
-
-
-
- private static void CheckConsistency(MethodAttributes attributes, CallingConventions callingConvention)
- {
-
- if ((attributes & ~MethodAttributes.MemberAccessMask) != MethodAttributes.Static)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicMethodFlags"));
- if ((attributes & MethodAttributes.MemberAccessMask) != MethodAttributes.Public)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicMethodFlags"));
-
-
- if (callingConvention != CallingConventions.Standard && callingConvention != CallingConventions.VarArgs)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicMethodFlags"));
-
-
- if (callingConvention == CallingConventions.VarArgs)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicMethodFlags"));
- }
-
- unsafe private void Init(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] signature, Type owner, Module m, bool skipVisibility)
- {
-
- DynamicMethod.CheckConsistency(attributes, callingConvention);
-
-
- if (signature != null) {
- m_parameterTypes = new RuntimeType[signature.Length];
- for (int i = 0; i < signature.Length; i++) {
- if (signature[i] == null)
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidTypeInSignature"));
- m_parameterTypes[i] = signature[i].UnderlyingSystemType as RuntimeType;
- if (m_parameterTypes[i] == null || m_parameterTypes[i] == typeof(void))
- throw new ArgumentException(Environment.GetResourceString("Arg_InvalidTypeInSignature"));
- }
- }
- else
- m_parameterTypes = new RuntimeType[0];
-
-
- m_returnType = (returnType == null) ? ((RuntimeType)typeof(void)) : (returnType.UnderlyingSystemType as RuntimeType);
- if (m_returnType == null || m_returnType.IsByRef)
- throw new NotSupportedException(Environment.GetResourceString("Arg_InvalidTypeInRetType"));
-
- m_typeOwner = (owner != null) ? owner.UnderlyingSystemType as RuntimeType : null;
- if (m_typeOwner != null)
- if (m_typeOwner.HasElementType || m_typeOwner.ContainsGenericParameters || m_typeOwner.IsGenericParameter || m_typeOwner.IsInterface)
- throw new ArgumentException(Environment.GetResourceString("Argument_InvalidTypeForDynamicMethod"));
-
- m_module = (m != null) ? m.ModuleHandle : m_typeOwner.Module.ModuleHandle;
-
-
- m_ilGenerator = null;
- m_fInitLocals = true;
- m_method = new RuntimeMethodHandle(null);
- m_skipVisibility = skipVisibility;
-
- if (name == null)
- throw new ArgumentNullException("name");
- m_dynMethod = new RTDynamicMethod(this, name, attributes, callingConvention);
- }
-
- private static void PerformSecurityCheck(Module m, ref StackCrawlMark stackMark, bool skipVisibility)
- {
- unsafe {
- if (m == null)
- throw new ArgumentNullException("m");
-
-
- new ReflectionPermission(ReflectionPermissionFlag.ReflectionEmit).Demand();
-
- if (skipVisibility)
- new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand();
-
-
- RuntimeTypeHandle callingType = ModuleHandle.GetCallerType(ref stackMark);
- if (!m.Assembly.AssemblyHandle.Equals(callingType.GetAssemblyHandle()))
- new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
- }
- }
-
- private static void PerformSecurityCheck(Type owner, ref StackCrawlMark stackMark, bool skipVisibility)
- {
- unsafe {
- if (owner == null || ((owner = owner.UnderlyingSystemType as RuntimeType) == null))
- throw new ArgumentNullException("owner");
-
-
- new ReflectionPermission(ReflectionPermissionFlag.ReflectionEmit).Demand();
-
-
- RuntimeTypeHandle callingType = ModuleHandle.GetCallerType(ref stackMark);
-
-
- if (skipVisibility)
- new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand();
- else {
-
- if (!callingType.Equals(owner.TypeHandle))
- new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand();
- }
-
-
- if (!owner.Assembly.AssemblyHandle.Equals(callingType.GetAssemblyHandle()))
- new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
- }
- }
-
-
-
-
-
- [System.Runtime.InteropServices.ComVisible(true)]
- public Delegate CreateDelegate(Type delegateType)
- {
- MulticastDelegate d = (MulticastDelegate)Delegate.CreateDelegate(delegateType, null, GetMethodDescriptor());
-
- d.StoreDynamicMethod(GetMethodInfo());
-
- object[] invocationList = new object[1] {d};
- return d.NewMulticastDelegate(invocationList, invocationList.Length);
- }
-
- [System.Runtime.InteropServices.ComVisible(true)]
- public Delegate CreateDelegate(Type delegateType, object target)
- {
- MulticastDelegate d = (MulticastDelegate)Delegate.CreateDelegate(delegateType, target, GetMethodDescriptor());
-
- d.StoreDynamicMethod(GetMethodInfo());
-
- object[] invocationList = new object[1] {d};
- return d.NewMulticastDelegate(invocationList, invocationList.Length);
- }
-
- unsafe internal RuntimeMethodHandle GetMethodDescriptor()
- {
- if (m_method.IsNullHandle()) {
- lock (this) {
- if (m_method.IsNullHandle()) {
- if (m_DynamicILInfo != null)
- m_method = m_DynamicILInfo.GetCallableMethod(m_module.Value);
- else {
- if (m_ilGenerator == null || m_ilGenerator.m_length == 0)
- throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("InvalidOperation_BadEmptyMethodBody"), Name));
-
- m_method = m_ilGenerator.GetCallableMethod(m_module.Value);
- }
- }
- }
- }
- return m_method;
- }
-
-
-
-
-
- public override string ToString()
- {
- return m_dynMethod.ToString();
- }
-
- public override string Name {
- get { return m_dynMethod.Name; }
- }
-
- public override Type DeclaringType {
- get { return m_dynMethod.DeclaringType; }
- }
-
- public override Type ReflectedType {
- get { return m_dynMethod.ReflectedType; }
- }
-
- internal override int MetadataTokenInternal {
- get { return m_dynMethod.MetadataTokenInternal; }
- }
-
- public override Module Module {
- get { return m_dynMethod.Module; }
- }
-
-
- public override RuntimeMethodHandle MethodHandle {
- get {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAllowedInDynamicMethod"));
- }
- }
-
- public override MethodAttributes Attributes {
- get { return m_dynMethod.Attributes; }
- }
-
- public override CallingConventions CallingConvention {
- get { return m_dynMethod.CallingConvention; }
- }
-
- public override MethodInfo GetBaseDefinition()
- {
- return this;
- }
-
- public override ParameterInfo[] GetParameters()
- {
- return m_dynMethod.GetParameters();
- }
-
- public override MethodImplAttributes GetMethodImplementationFlags()
- {
- return m_dynMethod.GetMethodImplementationFlags();
- }
-
- public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
- {
- return m_dynMethod.Invoke(obj, invokeAttr, binder, parameters, culture);
- }
-
- public override object[] GetCustomAttributes(Type attributeType, bool inherit)
- {
- return m_dynMethod.GetCustomAttributes(attributeType, inherit);
- }
-
- public override object[] GetCustomAttributes(bool inherit)
- {
- return m_dynMethod.GetCustomAttributes(inherit);
- }
-
- public override bool IsDefined(Type attributeType, bool inherit)
- {
- return m_dynMethod.IsDefined(attributeType, inherit);
- }
-
- public override Type ReturnType {
- get { return m_dynMethod.ReturnType; }
- }
-
- public override ParameterInfo ReturnParameter {
- get { return m_dynMethod.ReturnParameter; }
- }
-
- public override ICustomAttributeProvider ReturnTypeCustomAttributes {
- get { return m_dynMethod.ReturnTypeCustomAttributes; }
- }
-
- internal override bool IsOverloaded {
- get { return m_dynMethod.IsOverloaded; }
- }
-
-
-
-
-
- public ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, string parameterName)
- {
- if (position < 0 || position > m_parameterTypes.Length)
- throw new ArgumentOutOfRangeException(Environment.GetResourceString("ArgumentOutOfRange_ParamSequence"));
- position--;
-
- if (position >= 0) {
- ParameterInfo[] parameters = m_dynMethod.LoadParameters();
- parameters[position].SetName(parameterName);
- parameters[position].SetAttributes(attributes);
- }
- return null;
- }
-
- public DynamicILInfo GetDynamicILInfo()
- {
- new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
-
- if (m_DynamicILInfo != null)
- return m_DynamicILInfo;
-
- return GetDynamicILInfo(new DynamicScope());
- }
-
- internal DynamicILInfo GetDynamicILInfo(DynamicScope scope)
- {
- if (m_DynamicILInfo == null) {
- byte[] methodSignature = SignatureHelper.GetMethodSigHelper(null, CallingConvention, ReturnType, null, null, m_parameterTypes, null, null).GetSignature(true);
- m_DynamicILInfo = new DynamicILInfo(scope, this, methodSignature);
- }
-
- return m_DynamicILInfo;
- }
-
- public ILGenerator GetILGenerator()
- {
- return GetILGenerator(64);
- }
-
- public ILGenerator GetILGenerator(int streamSize)
- {
- if (m_ilGenerator == null) {
- byte[] methodSignature = SignatureHelper.GetMethodSigHelper(null, CallingConvention, ReturnType, null, null, m_parameterTypes, null, null).GetSignature(true);
- m_ilGenerator = new DynamicILGenerator(this, methodSignature, streamSize);
- }
- return m_ilGenerator;
- }
-
- public bool InitLocals {
- get { return m_fInitLocals; }
- set { m_fInitLocals = value; }
- }
-
-
-
-
-
- internal MethodInfo GetMethodInfo()
- {
- return m_dynMethod;
- }
-
- static internal DynamicMethod AsDynamicMethod(MethodBase meth)
- {
- DynamicMethod dynmeth = meth as DynamicMethod;
- if (dynmeth == null) {
- RTDynamicMethod rtdynmeth = meth as RTDynamicMethod;
- if (rtdynmeth != null) {
- dynmeth = rtdynmeth.m_owner;
- }
- }
- return dynmeth;
- }
-
- //////////////////////////////////////////////////////////////////////////////////////////////
-
-
-
-
-
-
- internal class RTDynamicMethod : MethodInfo
- {
-
- internal DynamicMethod m_owner;
- ParameterInfo[] m_parameters;
- string m_name;
- MethodAttributes m_attributes;
- CallingConventions m_callingConvention;
-
-
-
-
- private RTDynamicMethod()
- {
- }
-
- internal RTDynamicMethod(DynamicMethod owner, string name, MethodAttributes attributes, CallingConventions callingConvention)
- {
- m_owner = owner;
- m_name = name;
- m_attributes = attributes;
- m_callingConvention = callingConvention;
- }
-
-
-
-
- public override string ToString()
- {
- return ReturnType.SigToString() + " " + RuntimeMethodInfo.ConstructName(this);
- }
-
- public override string Name {
- get { return m_name; }
- }
-
- public override Type DeclaringType {
- get { return null; }
- }
-
- public override Type ReflectedType {
- get { return null; }
- }
-
- internal override int MetadataTokenInternal {
- get { return 0; }
- }
-
- public override Module Module {
- get { return m_owner.m_module.GetModule(); }
- }
-
- public override RuntimeMethodHandle MethodHandle {
- get {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_NotAllowedInDynamicMethod"));
- }
- }
-
- public override MethodAttributes Attributes {
- get { return m_attributes; }
- }
-
- public override CallingConventions CallingConvention {
- get { return m_callingConvention; }
- }
-
- public override MethodInfo GetBaseDefinition()
- {
- return this;
- }
-
- public override ParameterInfo[] GetParameters()
- {
- ParameterInfo[] privateParameters = LoadParameters();
- ParameterInfo[] parameters = new ParameterInfo[privateParameters.Length];
- Array.Copy(privateParameters, parameters, privateParameters.Length);
- return parameters;
- }
-
- public override MethodImplAttributes GetMethodImplementationFlags()
- {
- return MethodImplAttributes.IL | MethodImplAttributes.NoInlining;
- }
-
- public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
- {
-
- new ReflectionPermission(ReflectionPermissionFlag.MemberAccess).Demand();
-
- RuntimeMethodHandle method = m_owner.GetMethodDescriptor();
-
-
- if ((CallingConvention & CallingConventions.VarArgs) == CallingConventions.VarArgs)
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_CallToVarArg"));
-
-
- RuntimeTypeHandle[] argumentHandles = new RuntimeTypeHandle[m_owner.m_parameterTypes.Length];
- for (int i = 0; i < argumentHandles.Length; i++)
- argumentHandles[i] = m_owner.m_parameterTypes[i].TypeHandle;
- Signature sig = new Signature(method, argumentHandles, m_owner.m_returnType.TypeHandle, m_callingConvention);
-
-
-
- int formalCount = sig.Arguments.Length;
- int actualCount = (parameters != null) ? parameters.Length : 0;
- if (formalCount != actualCount)
- throw new TargetParameterCountException(Environment.GetResourceString("Arg_ParmCnt"));
-
-
- object retValue = null;
- if (actualCount > 0) {
- object[] arguments = CheckArguments(parameters, binder, invokeAttr, culture, sig);
- retValue = method.InvokeMethodFast(null, arguments, sig, m_attributes, RuntimeTypeHandle.EmptyHandle);
-
- for (int index = 0; index < actualCount; index++)
- parameters[index] = arguments[index];
- }
- else {
- retValue = method.InvokeMethodFast(null, null, sig, m_attributes, RuntimeTypeHandle.EmptyHandle);
- }
-
- GC.KeepAlive(this);
- return retValue;
- }
-
- public override object[] GetCustomAttributes(Type attributeType, bool inherit)
- {
- if (attributeType == null)
- throw new ArgumentNullException("attributeType");
-
- if (attributeType.IsAssignableFrom(typeof(MethodImplAttribute)))
- return new object[] {new MethodImplAttribute(GetMethodImplementationFlags())};
- else
- return new object[0];
- }
-
- public override object[] GetCustomAttributes(bool inherit)
- {
-
- return new object[] {new MethodImplAttribute(GetMethodImplementationFlags())};
- }
-
- public override bool IsDefined(Type attributeType, bool inherit)
- {
- if (attributeType == null)
- throw new ArgumentNullException("attributeType");
-
- if (attributeType.IsAssignableFrom(typeof(MethodImplAttribute)))
- return true;
- else
- return false;
- }
-
- internal override Type GetReturnType()
- {
- return m_owner.m_returnType;
- }
-
- public override ParameterInfo ReturnParameter {
- get { return null; }
- }
-
- public override ICustomAttributeProvider ReturnTypeCustomAttributes {
- get { return GetEmptyCAHolder(); }
- }
-
- internal override bool IsOverloaded {
- get { return false; }
- }
-
-
-
-
-
- internal ParameterInfo[] LoadParameters()
- {
- if (m_parameters == null) {
- RuntimeType[] parameterTypes = m_owner.m_parameterTypes;
- ParameterInfo[] parameters = new ParameterInfo[parameterTypes.Length];
- for (int i = 0; i < parameterTypes.Length; i++)
- parameters[i] = new ParameterInfo(this, null, parameterTypes[i], i);
- if (m_parameters == null)
-
- m_parameters = parameters;
- }
- return m_parameters;
- }
-
-
- private ICustomAttributeProvider GetEmptyCAHolder()
- {
- return new EmptyCAHolder();
- }
-
- ///////////////////////////////////////////////////
-
- private class EmptyCAHolder : ICustomAttributeProvider
- {
- internal EmptyCAHolder()
- {
- }
-
- object[] ICustomAttributeProvider.GetCustomAttributes(Type attributeType, bool inherit)
- {
- return new object[0];
- }
-
- object[] ICustomAttributeProvider.GetCustomAttributes(bool inherit)
- {
- return new object[0];
- }
-
- bool ICustomAttributeProvider.IsDefined(Type attributeType, bool inherit)
- {
- return false;
- }
- }
-
- }
-
- }
-
- }