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
-
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
-
AddDeclarativeSecurity(SecurityAction, PermissionSet)
-
Attributes()
-
CalculateNumberOfExceptions(__ExceptionInfo)
-
CallingConvention()
-
CheckContext(Type)
-
CheckContext(Type)
-
ContainsGenericParameters()
-
CreateMethodBody(byte, int)
-
CreateMethodBodyHelper(ILGenerator)
-
DeclaringType()
-
DefineGenericParameters(string)
-
DefineParameter(int, ParameterAttributes, string)
-
Equals(object)
-
GetBaseDefinition()
-
GetBody()
-
GetCustomAttributes(bool)
-
GetCustomAttributes(Type, bool)
-
GetExceptionInstances()
-
GetGenericArguments()
-
GetGenericMethodDefinition()
-
GetHashCode()
-
GetIDsOfNames(Guid, IntPtr, uint, uint, IntPtr)
-
GetILGenerator()
-
GetILGenerator(int)
-
GetLocalsSignature()
-
GetMethodImplementationFlags()
-
GetMethodSignature()
-
GetModule()
-
GetNumberOfExceptions()
-
GetParameters()
-
GetParameterTypes()
-
GetReturnType()
-
GetRVAFixups()
-
GetToken()
-
GetTokenFixups()
-
GetTypeBuilder()
-
GetTypeInfo(uint, uint, IntPtr)
-
GetTypeInfoCount(uint)
-
Init(string, MethodAttributes, CallingConventions, Type, Type, Type, Type, Type, Type, Module, TypeBuilder, bool)
-
InitLocals()
-
Invoke(object, BindingFlags, Binder, object, CultureInfo)
-
Invoke(uint, Guid, uint, short, IntPtr, IntPtr, IntPtr, IntPtr)
-
IsDefined(Type, bool)
-
IsGenericMethod()
-
IsGenericMethodDefinition()
-
IsKnownCA(ConstructorInfo)
-
IsTypeCreated()
-
MakeGenericMethod(Type)
-
MetadataTokenInternal()
-
MethodBuilder(string, MethodAttributes, CallingConventions, Type, Type, Module, TypeBuilder, bool)
-
MethodBuilder(string, MethodAttributes, CallingConventions, Type, Type, Type, Type, Type, Type, Module, TypeBuilder, bool)
-
MethodHandle()
-
Module()
-
Name()
-
ParseCA(ConstructorInfo, byte)
-
ReflectedType()
-
ReturnParameter()
-
ReturnTypeCustomAttributes()
-
SetCustomAttribute(ConstructorInfo, byte)
-
SetCustomAttribute(CustomAttributeBuilder)
-
SetImplementationFlags(MethodImplAttributes)
-
SetMarshal(UnmanagedMarshal)
-
SetParameters(Type)
-
SetReturnType(Type)
-
SetSignature(Type, Type, Type, Type, Type, Type)
-
SetSymCustomAttribute(string, byte)
-
SetToken(MethodToken)
-
Signature()
-
ThrowIfGeneric()
-
ThrowIfShouldNotHaveBody()
-
ToString()
-
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.Text;
- using System;
- using CultureInfo = System.Globalization.CultureInfo;
- using System.Diagnostics.SymbolStore;
- using System.Reflection;
- using System.Security;
- using System.Collections;
- using System.Security.Permissions;
- using System.Runtime.InteropServices;
-
- [HostProtection(MayLeakOnAbort = true)]
- [ClassInterface(ClassInterfaceType.None)]
- [ComDefaultInterface(typeof(_MethodBuilder))]
- [System.Runtime.InteropServices.ComVisible(true)]
- public sealed class MethodBuilder : MethodInfo, _MethodBuilder
- {
- #region Private Data Members
-
- internal string m_strName;
-
- private MethodToken m_tkMethod;
-
- internal Module m_module;
- internal TypeBuilder m_containingType;
- private MethodBuilder m_link;
-
-
- private int[] m_RVAFixups;
-
- private int[] m_mdMethodFixups;
-
- private SignatureHelper m_localSignature;
- internal LocalSymInfo m_localSymInfo;
-
- internal ILGenerator m_ilGenerator;
- private byte[] m_ubBody;
-
- private int m_numExceptions;
-
- private __ExceptionInstance[] m_exceptions;
-
-
- internal bool m_bIsBaked;
- private bool m_bIsGlobalMethod;
- private bool m_fInitLocals;
-
-
- private MethodAttributes m_iAttributes;
- private CallingConventions m_callingConvention;
- private MethodImplAttributes m_dwMethodImplFlags;
-
-
- private SignatureHelper m_signature;
- internal Type[] m_parameterTypes;
- private ParameterBuilder m_retParam;
- internal Type m_returnType;
- private Type[] m_returnTypeRequiredCustomModifiers;
- private Type[] m_returnTypeOptionalCustomModifiers;
- private Type[][] m_parameterTypeRequiredCustomModifiers;
- private Type[][] m_parameterTypeOptionalCustomModifiers;
-
-
- private GenericTypeParameterBuilder[] m_inst;
- private bool m_bIsGenMethDef;
- #endregion
-
- #region Constructor
- internal MethodBuilder(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] parameterTypes, Module mod, TypeBuilder type, bool bIsGlobalMethod)
- {
- Init(name, attributes, callingConvention, returnType, null, null, parameterTypes, null, null, mod,
- type, bIsGlobalMethod);
- }
-
- internal MethodBuilder(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers, Module mod,
- TypeBuilder type, bool bIsGlobalMethod)
- {
- Init(name, attributes, callingConvention, returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, mod,
- type, bIsGlobalMethod);
- }
-
- private void Init(string name, MethodAttributes attributes, CallingConventions callingConvention, Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers, Module mod,
- TypeBuilder type, bool bIsGlobalMethod)
- {
- if (name == null)
- throw new ArgumentNullException("name");
-
- if (name.Length == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_EmptyName"), "name");
-
- if (name[0] == '\0')
- throw new ArgumentException(Environment.GetResourceString("Argument_IllegalName"), "name");
-
- if (mod == null)
- throw new ArgumentNullException("mod");
-
- if (parameterTypes != null) {
- foreach (Type t in parameterTypes) {
- if (t == null)
- throw new ArgumentNullException("parameterTypes");
- }
- }
-
- m_link = type.m_currentMethod;
- type.m_currentMethod = this;
- m_strName = name;
- m_module = mod;
- m_containingType = type;
- m_localSignature = SignatureHelper.GetLocalVarSigHelper(mod);
-
-
-
-
-
-
-
- {
- m_returnType = returnType;
- }
-
- if ((attributes & MethodAttributes.Static) == 0) {
-
- callingConvention = callingConvention | CallingConventions.HasThis;
- }
- else if ((attributes & MethodAttributes.Virtual) != 0) {
-
- throw new ArgumentException(Environment.GetResourceString("Arg_NoStaticVirtual"));
- }
-
- if ((attributes & MethodAttributes.SpecialName) != MethodAttributes.SpecialName) {
- if ((type.Attributes & TypeAttributes.Interface) == TypeAttributes.Interface) {
-
- if ((attributes & (MethodAttributes.Abstract | MethodAttributes.Virtual)) != (MethodAttributes.Abstract | MethodAttributes.Virtual) && (attributes & MethodAttributes.Static) == 0)
- throw new ArgumentException(Environment.GetResourceString("Argument_BadAttributeOnInterfaceMethod"));
- }
- }
-
- m_callingConvention = callingConvention;
-
- if (parameterTypes != null) {
- m_parameterTypes = new Type[parameterTypes.Length];
- Array.Copy(parameterTypes, m_parameterTypes, parameterTypes.Length);
- }
- else {
- m_parameterTypes = null;
- }
-
- m_returnTypeRequiredCustomModifiers = returnTypeRequiredCustomModifiers;
- m_returnTypeOptionalCustomModifiers = returnTypeOptionalCustomModifiers;
- m_parameterTypeRequiredCustomModifiers = parameterTypeRequiredCustomModifiers;
- m_parameterTypeOptionalCustomModifiers = parameterTypeOptionalCustomModifiers;
-
-
-
-
-
- m_iAttributes = attributes;
- m_bIsGlobalMethod = bIsGlobalMethod;
- m_bIsBaked = false;
- m_fInitLocals = true;
-
- m_localSymInfo = new LocalSymInfo();
- m_ubBody = null;
- m_ilGenerator = null;
-
-
- m_dwMethodImplFlags = MethodImplAttributes.IL;
-
-
- }
-
- #endregion
-
- #region Internal Members
- internal void CheckContext(params Type[][] typess)
- {
- ((AssemblyBuilder)Module.Assembly).CheckContext(typess);
- }
- internal void CheckContext(params Type[] types)
- {
- ((AssemblyBuilder)Module.Assembly).CheckContext(types);
- }
-
- internal void CreateMethodBodyHelper(ILGenerator il)
- {
-
-
-
- __ExceptionInfo[] excp;
- int counter = 0;
- int[] filterAddrs;
- int[] catchAddrs;
- int[] catchEndAddrs;
- Type[] catchClass;
- int[] type;
- int numCatch;
- int start;
- int end;
- ModuleBuilder dynMod = (ModuleBuilder)m_module;
-
- m_containingType.ThrowIfCreated();
-
- if (m_bIsBaked) {
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_MethodHasBody"));
- }
-
- if (il == null) {
- throw new ArgumentNullException("il");
- }
-
- if (il.m_methodBuilder != this && il.m_methodBuilder != null) {
-
-
-
-
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_BadILGeneratorUsage"));
- }
-
- ThrowIfShouldNotHaveBody();
-
- if (il.m_ScopeTree.m_iOpenScopeCount != 0) {
-
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_OpenLocalVariableScope"));
- }
-
-
- m_ubBody = il.BakeByteArray();
-
- m_RVAFixups = il.GetRVAFixups();
- m_mdMethodFixups = il.GetTokenFixups();
-
-
- excp = il.GetExceptions();
- m_numExceptions = CalculateNumberOfExceptions(excp);
- if (m_numExceptions > 0) {
-
- m_exceptions = new __ExceptionInstance[m_numExceptions];
-
- for (int i = 0; i < excp.Length; i++) {
- filterAddrs = excp[i].GetFilterAddresses();
- catchAddrs = excp[i].GetCatchAddresses();
- catchEndAddrs = excp[i].GetCatchEndAddresses();
- catchClass = excp[i].GetCatchClass();
-
-
-
- for (int j = 0; j < catchClass.Length; j++) {
- if (catchClass[j] != null)
- dynMod.GetTypeToken(catchClass[j]);
- }
-
- numCatch = excp[i].GetNumberOfCatches();
- start = excp[i].GetStartAddress();
- end = excp[i].GetEndAddress();
- type = excp[i].GetExceptionTypes();
- for (int j = 0; j < numCatch; j++) {
- int tkExceptionClass = 0;
- if (catchClass[j] != null)
- tkExceptionClass = dynMod.GetTypeToken(catchClass[j]).Token;
- switch (type[j]) {
- case __ExceptionInfo.None:
- case __ExceptionInfo.Fault:
- case __ExceptionInfo.Filter:
- m_exceptions[counter++] = new __ExceptionInstance(start, end, filterAddrs[j], catchAddrs[j], catchEndAddrs[j], type[j], tkExceptionClass);
- break;
- case __ExceptionInfo.Finally:
-
- m_exceptions[counter++] = new __ExceptionInstance(start, excp[i].GetFinallyEndAddress(), filterAddrs[j], catchAddrs[j], catchEndAddrs[j], type[j], tkExceptionClass);
- break;
- }
- }
-
- }
- }
-
-
- m_bIsBaked = true;
-
- if (dynMod.GetSymWriter() != null) {
-
-
-
-
- SymbolToken tk = new SymbolToken(MetadataTokenInternal);
- ISymbolWriter symWriter = dynMod.GetSymWriter();
-
-
- symWriter.OpenMethod(tk);
-
-
-
-
- symWriter.OpenScope(0);
-
- if (m_symCustomAttrs != null) {
- foreach (SymCustomAttr symCustomAttr in m_symCustomAttrs)
- dynMod.GetSymWriter().SetSymAttribute(new SymbolToken(MetadataTokenInternal), symCustomAttr.m_name, symCustomAttr.m_data);
- }
-
- if (m_localSymInfo != null)
- m_localSymInfo.EmitLocalSymInfo(symWriter);
- il.m_ScopeTree.EmitScopeTree(symWriter);
- il.m_LineNumberInfo.EmitLineNumberInfo(symWriter);
- symWriter.CloseScope(il.m_length);
- symWriter.CloseMethod();
- }
- }
-
- internal override Type[] GetParameterTypes()
- {
- if (m_parameterTypes == null)
- m_parameterTypes = new Type[0];
-
- return m_parameterTypes;
- }
-
- internal void SetToken(MethodToken token)
- {
- m_tkMethod = token;
- }
-
- internal byte[] GetBody()
- {
-
-
- return m_ubBody;
- }
-
- internal int[] GetTokenFixups()
- {
- return m_mdMethodFixups;
- }
-
- internal int[] GetRVAFixups()
- {
- return m_RVAFixups;
- }
-
- internal SignatureHelper GetMethodSignature()
- {
- if (m_parameterTypes == null)
- m_parameterTypes = new Type[0];
-
- m_signature = SignatureHelper.GetMethodSigHelper(m_module, m_callingConvention, m_inst != null ? m_inst.Length : 0, m_returnType == null ? typeof(void) : m_returnType, m_returnTypeRequiredCustomModifiers, m_returnTypeOptionalCustomModifiers, m_parameterTypes, m_parameterTypeRequiredCustomModifiers, m_parameterTypeOptionalCustomModifiers);
-
- return m_signature;
- }
-
- internal SignatureHelper GetLocalsSignature()
- {
- if (m_ilGenerator != null) {
- if (m_ilGenerator.m_localCount != 0) {
-
- return m_ilGenerator.m_localSignature;
- }
- }
-
- return m_localSignature;
- }
-
- internal int GetNumberOfExceptions()
- {
- return m_numExceptions;
- }
-
- internal __ExceptionInstance[] GetExceptionInstances()
- {
- return m_exceptions;
- }
-
- internal int CalculateNumberOfExceptions(__ExceptionInfo[] excp)
- {
- int num = 0;
-
- if (excp == null) {
- return 0;
- }
-
- for (int i = 0; i < excp.Length; i++) {
- num += excp[i].GetNumberOfCatches();
- }
-
- return num;
- }
-
- internal bool IsTypeCreated()
- {
- return (m_containingType != null && m_containingType.m_hasBeenCreated);
- }
-
- internal TypeBuilder GetTypeBuilder()
- {
- return m_containingType;
- }
- #endregion
-
- #region Object Overrides
- public override bool Equals(object obj)
- {
- if (!(obj is MethodBuilder)) {
- return false;
- }
- if (!(this.m_strName.Equals(((MethodBuilder)obj).m_strName))) {
- return false;
- }
-
- if (m_iAttributes != (((MethodBuilder)obj).m_iAttributes)) {
- return false;
- }
-
- SignatureHelper thatSig = ((MethodBuilder)obj).GetMethodSignature();
- if (thatSig.Equals(GetMethodSignature())) {
- return true;
- }
- return false;
- }
-
- public override int GetHashCode()
- {
- return this.m_strName.GetHashCode();
- }
-
- public override string ToString()
- {
- StringBuilder sb = new StringBuilder(1000);
- sb.Append("Name: " + m_strName + " " + Environment.NewLine);
- sb.Append("Attributes: " + (int)m_iAttributes + Environment.NewLine);
- sb.Append("Method Signature: " + GetMethodSignature() + Environment.NewLine);
-
- sb.Append(Environment.NewLine);
- return sb.ToString();
- }
-
- #endregion
-
- #region MemberInfo Overrides
- public override string Name {
- get { return m_strName; }
- }
-
- internal override int MetadataTokenInternal {
- get { return GetToken().Token; }
- }
-
- public override Module Module {
- get { return m_containingType.Module; }
- }
-
- public override Type DeclaringType {
- get {
- if (m_containingType.m_isHiddenGlobalType == true)
- return null;
- return m_containingType;
- }
- }
-
- public override ICustomAttributeProvider ReturnTypeCustomAttributes {
- get { return null; }
- }
-
- public override Type ReflectedType {
- get {
- if (m_containingType.m_isHiddenGlobalType == true)
- return null;
- return m_containingType;
- }
- }
-
- #endregion
-
- #region MethodBase Overrides
- public override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
- {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
- }
-
- public override MethodImplAttributes GetMethodImplementationFlags()
- {
- return m_dwMethodImplFlags;
- }
-
- public override MethodAttributes Attributes {
- get { return m_iAttributes; }
- }
-
- public override CallingConventions CallingConvention {
- get { return m_callingConvention; }
- }
-
- public override RuntimeMethodHandle MethodHandle {
- get {
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
- }
- }
-
- #endregion
-
- #region MethodInfo Overrides
- public override MethodInfo GetBaseDefinition()
- {
- return this;
- }
-
- internal override Type GetReturnType()
- {
- return m_returnType;
- }
-
- public override ParameterInfo[] GetParameters()
- {
- if (!m_bIsBaked)
- throw new NotSupportedException(Environment.GetResourceString("InvalidOperation_TypeNotCreated"));
-
- Type rti = m_containingType.m_runtimeType;
- MethodInfo rmi = rti.GetMethod(m_strName, m_parameterTypes);
-
- return rmi.GetParameters();
- }
-
- public override ParameterInfo ReturnParameter {
- get {
- if (!m_bIsBaked)
- throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_TypeNotCreated"));
-
- Type rti = m_containingType.m_runtimeType;
- MethodInfo rmi = rti.GetMethod(m_strName, m_parameterTypes);
-
- return rmi.ReturnParameter;
- }
- }
- #endregion
-
- #region ICustomAttributeProvider Implementation
- public override object[] GetCustomAttributes(bool inherit)
- {
-
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
- }
-
- public override object[] GetCustomAttributes(Type attributeType, bool inherit)
- {
-
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
- }
-
- public override bool IsDefined(Type attributeType, bool inherit)
- {
-
- throw new NotSupportedException(Environment.GetResourceString("NotSupported_DynamicModule"));
- }
-
- #endregion
-
- #region Generic Members
- public override bool IsGenericMethodDefinition {
- get { return m_bIsGenMethDef; }
- }
-
- public override bool ContainsGenericParameters {
- get {
- throw new NotSupportedException();
- }
- }
-
- public override MethodInfo GetGenericMethodDefinition()
- {
- if (!IsGenericMethod)
- throw new InvalidOperationException();
- return this;
- }
-
- public override bool IsGenericMethod {
- get { return m_inst != null; }
- }
-
- public override Type[] GetGenericArguments()
- {
- return m_inst;
- }
-
- public override MethodInfo MakeGenericMethod(params Type[] typeArguments)
- {
- return new MethodBuilderInstantiation(this, typeArguments);
- }
-
-
- public GenericTypeParameterBuilder[] DefineGenericParameters(params string[] names)
- {
- if (m_inst != null)
- throw new InvalidOperationException();
-
- if (names == null)
- throw new ArgumentNullException("names");
-
- for (int i = 0; i < names.Length; i++)
- if (names[i] == null)
- throw new ArgumentNullException("names");
-
- if (m_tkMethod.Token != 0)
- throw new InvalidOperationException();
-
- if (names.Length == 0)
- throw new ArgumentException();
-
- m_bIsGenMethDef = true;
- m_inst = new GenericTypeParameterBuilder[names.Length];
- for (int i = 0; i < names.Length; i++)
- m_inst[i] = new GenericTypeParameterBuilder(new TypeBuilder(names[i], i, this));
-
- return m_inst;
- }
-
- internal void ThrowIfGeneric()
- {
- if (IsGenericMethod && !IsGenericMethodDefinition)
- throw new InvalidOperationException();
- }
- #endregion
-
- #region Public Members
- public MethodToken GetToken()
- {
- if (m_tkMethod.Token == 0) {
- if (m_link != null)
- m_link.GetToken();
-
- int sigLength;
- byte[] sigBytes = GetMethodSignature().InternalGetSignature(out sigLength);
-
- m_tkMethod = new MethodToken(TypeBuilder.InternalDefineMethod(m_containingType.MetadataTokenInternal, m_strName, sigBytes, sigLength, Attributes, m_module));
-
- if (m_inst != null)
- foreach (GenericTypeParameterBuilder tb in m_inst)
- if (!tb.m_type.IsCreated())
- tb.m_type.CreateType();
-
- TypeBuilder.InternalSetMethodImpl(m_module, MetadataTokenInternal, m_dwMethodImplFlags);
- }
-
- return m_tkMethod;
- }
-
- public void SetParameters(params Type[] parameterTypes)
- {
- CheckContext(parameterTypes);
- SetSignature(null, null, null, parameterTypes, null, null);
- }
-
- public void SetReturnType(Type returnType)
- {
- CheckContext(returnType);
- SetSignature(returnType, null, null, null, null, null);
- }
-
- public void SetSignature(Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
- {
- CheckContext(returnType);
- CheckContext(returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes);
- CheckContext(parameterTypeRequiredCustomModifiers);
- CheckContext(parameterTypeOptionalCustomModifiers);
-
- ThrowIfGeneric();
-
- if (returnType !