19 private struct SymCustomAttr
25 public SymCustomAttr(
string name,
byte[] data)
32 internal string m_strName;
40 private int[] m_mdMethodFixups;
42 private byte[] m_localSignature;
44 internal LocalSymInfo m_localSymInfo;
48 private byte[] m_ubBody;
52 private const int DefaultMaxStack = 16;
54 private int m_maxStack = 16;
56 internal bool m_bIsBaked;
58 private bool m_bIsGlobalMethod;
60 private bool m_fInitLocals;
70 internal Type[] m_parameterTypes;
74 private Type m_returnType;
76 private Type[] m_returnTypeRequiredCustomModifiers;
78 private Type[] m_returnTypeOptionalCustomModifiers;
80 private Type[][] m_parameterTypeRequiredCustomModifiers;
82 private Type[][] m_parameterTypeOptionalCustomModifiers;
86 private bool m_bIsGenMethDef;
90 internal bool m_canBeRuntimeImpl;
92 internal bool m_isDllImport;
94 internal int ExceptionHandlerCount
98 if (m_exceptions ==
null)
102 return m_exceptions.Length;
108 public override string Name => m_strName;
122 if (m_containingType.m_isHiddenGlobalType)
126 return m_containingType;
201 if (!m_bIsBaked || m_containingType ==
null || m_containingType.BakedRuntimeType ==
null)
240 return m_fInitLocals;
245 m_fInitLocals = value;
253 [SecuritySafeCritical]
256 return GetMethodSignature().
ToString();
262 Init(name, attributes, callingConvention, returnType,
null,
null, parameterTypes,
null,
null, mod, type, bIsGlobalMethod);
265 internal MethodBuilder(
string name,
MethodAttributes attributes,
CallingConventions callingConvention,
Type returnType,
Type[] returnTypeRequiredCustomModifiers,
Type[] returnTypeOptionalCustomModifiers,
Type[] parameterTypes,
Type[][] parameterTypeRequiredCustomModifiers,
Type[][] parameterTypeOptionalCustomModifiers, ModuleBuilder mod, TypeBuilder type,
bool bIsGlobalMethod)
267 Init(name, attributes, callingConvention, returnType, returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes, parameterTypeRequiredCustomModifiers, parameterTypeOptionalCustomModifiers, mod, type, bIsGlobalMethod);
270 private void Init(
string name,
MethodAttributes attributes,
CallingConventions callingConvention,
Type returnType,
Type[] returnTypeRequiredCustomModifiers,
Type[] returnTypeOptionalCustomModifiers,
Type[] parameterTypes,
Type[][] parameterTypeRequiredCustomModifiers,
Type[][] parameterTypeOptionalCustomModifiers, ModuleBuilder mod, TypeBuilder type,
bool bIsGlobalMethod)
276 if (name.Length == 0)
278 throw new ArgumentException(Environment.GetResourceString(
"Argument_EmptyName"),
"name");
282 throw new ArgumentException(Environment.GetResourceString(
"Argument_IllegalName"),
"name");
286 throw new ArgumentNullException(
"mod");
288 if (parameterTypes !=
null)
290 foreach (Type left
in parameterTypes)
294 throw new ArgumentNullException(
"parameterTypes");
300 m_containingType = type;
301 m_returnType = returnType;
308 throw new ArgumentException(Environment.GetResourceString(
"Arg_NoStaticVirtual"));
312 throw new ArgumentException(Environment.GetResourceString(
"Argument_BadAttributeOnInterfaceMethod"));
314 m_callingConvention = callingConvention;
315 if (parameterTypes !=
null)
317 m_parameterTypes =
new Type[parameterTypes.Length];
318 Array.Copy(parameterTypes, m_parameterTypes, parameterTypes.Length);
322 m_parameterTypes =
null;
324 m_returnTypeRequiredCustomModifiers = returnTypeRequiredCustomModifiers;
325 m_returnTypeOptionalCustomModifiers = returnTypeOptionalCustomModifiers;
326 m_parameterTypeRequiredCustomModifiers = parameterTypeRequiredCustomModifiers;
327 m_parameterTypeOptionalCustomModifiers = parameterTypeOptionalCustomModifiers;
328 m_iAttributes = attributes;
329 m_bIsGlobalMethod = bIsGlobalMethod;
331 m_fInitLocals =
true;
332 m_localSymInfo =
new LocalSymInfo();
334 m_ilGenerator =
null;
338 internal void CheckContext(params Type[][] typess)
340 m_module.CheckContext(typess);
343 internal void CheckContext(params Type[] types)
345 m_module.CheckContext(types);
349 internal void CreateMethodBodyHelper(ILGenerator il)
353 throw new ArgumentNullException(
"il");
356 ModuleBuilder module = m_module;
357 m_containingType.ThrowIfCreated();
360 throw new InvalidOperationException(Environment.GetResourceString(
"InvalidOperation_MethodHasBody"));
362 if (il.m_methodBuilder !=
this && il.m_methodBuilder !=
null)
364 throw new InvalidOperationException(Environment.GetResourceString(
"InvalidOperation_BadILGeneratorUsage"));
366 ThrowIfShouldNotHaveBody();
367 if (il.m_ScopeTree.m_iOpenScopeCount != 0)
369 throw new InvalidOperationException(Environment.GetResourceString(
"InvalidOperation_OpenLocalVariableScope"));
371 m_ubBody = il.BakeByteArray();
372 m_mdMethodFixups = il.GetTokenFixups();
373 __ExceptionInfo[] exceptions = il.GetExceptions();
374 int num2 = CalculateNumberOfExceptions(exceptions);
377 m_exceptions =
new ExceptionHandler[num2];
378 for (
int i = 0; i < exceptions.Length; i++)
380 int[] filterAddresses = exceptions[i].GetFilterAddresses();
381 int[] catchAddresses = exceptions[i].GetCatchAddresses();
382 int[] catchEndAddresses = exceptions[i].GetCatchEndAddresses();
383 Type[] catchClass = exceptions[i].GetCatchClass();
384 int numberOfCatches = exceptions[i].GetNumberOfCatches();
385 int startAddress = exceptions[i].GetStartAddress();
386 int endAddress = exceptions[i].GetEndAddress();
387 int[] exceptionTypes = exceptions[i].GetExceptionTypes();
388 for (
int j = 0; j < numberOfCatches; j++)
390 int exceptionTypeToken = 0;
391 if (catchClass[j] !=
null)
393 exceptionTypeToken = module.GetTypeTokenInternal(catchClass[j]).Token;
395 switch (exceptionTypes[j])
400 m_exceptions[num++] =
new ExceptionHandler(startAddress, endAddress, filterAddresses[j], catchAddresses[j], catchEndAddresses[j], exceptionTypes[j], exceptionTypeToken);
403 m_exceptions[num++] =
new ExceptionHandler(startAddress, exceptions[i].GetFinallyEndAddress(), filterAddresses[j], catchAddresses[j], catchEndAddresses[j], exceptionTypes[j], exceptionTypeToken);
410 if (module.GetSymWriter() !=
null)
416 if (m_symCustomAttrs !=
null)
418 foreach (SymCustomAttr symCustomAttr
in m_symCustomAttrs)
420 module.GetSymWriter().SetSymAttribute(
new SymbolToken(MetadataTokenInternal), symCustomAttr.m_name, symCustomAttr.m_data);
423 if (m_localSymInfo !=
null)
425 m_localSymInfo.EmitLocalSymInfo(symWriter);
427 il.m_ScopeTree.EmitScopeTree(symWriter);
428 il.m_LineNumberInfo.EmitLineNumberInfo(symWriter);
434 internal void ReleaseBakedStructures()
439 m_localSymInfo =
null;
440 m_mdMethodFixups =
null;
441 m_localSignature =
null;
446 internal override Type[] GetParameterTypes()
448 if (m_parameterTypes ==
null)
450 m_parameterTypes = EmptyArray<Type>.Value;
452 return m_parameterTypes;
455 internal static Type GetMethodBaseReturnType(MethodBase method)
457 MethodInfo methodInfo =
null;
458 ConstructorInfo constructorInfo =
null;
459 if ((methodInfo = (method as MethodInfo)) !=
null)
461 return methodInfo.ReturnType;
463 if ((constructorInfo = (method as ConstructorInfo)) !=
null)
465 return constructorInfo.GetReturnType();
470 internal void SetToken(MethodToken token)
475 internal byte[] GetBody()
480 internal int[] GetTokenFixups()
482 return m_mdMethodFixups;
486 internal SignatureHelper GetMethodSignature()
488 if (m_parameterTypes ==
null)
490 m_parameterTypes = EmptyArray<Type>.Value;
492 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);
496 internal byte[] GetLocalSignature(out
int signatureLength)
498 if (m_localSignature !=
null)
500 signatureLength = m_localSignature.Length;
501 return m_localSignature;
503 if (m_ilGenerator !=
null && m_ilGenerator.m_localCount != 0)
505 return m_ilGenerator.m_localSignature.InternalGetSignature(out signatureLength);
507 return SignatureHelper.GetLocalVarSigHelper(m_module).InternalGetSignature(out signatureLength);
510 internal int GetMaxStack()
512 if (m_ilGenerator !=
null)
514 return m_ilGenerator.GetMaxStackSize() + ExceptionHandlerCount;
519 internal ExceptionHandler[] GetExceptionHandlers()
524 internal int CalculateNumberOfExceptions(__ExceptionInfo[] excp)
531 for (
int i = 0; i < excp.Length; i++)
533 num += excp[i].GetNumberOfCatches();
538 internal bool IsTypeCreated()
540 if (m_containingType !=
null)
547 internal TypeBuilder GetTypeBuilder()
549 return m_containingType;
552 internal ModuleBuilder GetModuleBuilder()
561 [SecuritySafeCritical]
577 if (methodSignature.
Equals(GetMethodSignature()))
588 return m_strName.GetHashCode();
593 [SecuritySafeCritical]
621 return m_dwMethodImplFlags;
636 if (!m_bIsBaked || m_containingType ==
null || m_containingType.BakedRuntimeType ==
null)
715 if (names.Length == 0)
723 for (
int i = 0; i < names.Length; i++)
725 if (names[i] ==
null)
730 if (m_tkMethod.
Token != 0)
734 m_bIsGenMethDef =
true;
736 for (
int j = 0; j < names.Length; j++)
743 internal void ThrowIfGeneric()
753 [SecuritySafeCritical]
756 if (m_tkMethod.
Token != 0)
762 lock (m_containingType.m_listMethods)
764 if (m_tkMethod.
Token != 0)
769 for (i = m_containingType.m_lastTokenizedMethod + 1; i < m_containingType.m_listMethods.Count; i++)
771 methodBuilder = m_containingType.m_listMethods[i];
772 result = methodBuilder.GetTokenNoLock();
773 if (methodBuilder ==
this)
778 m_containingType.m_lastTokenizedMethod = i;
787 byte[] signature = GetMethodSignature().InternalGetSignature(out length);
788 int num =
TypeBuilder.DefineMethod(m_module.GetNativeHandle(), m_containingType.MetadataTokenInternal, m_strName, signature, length,
Attributes);
795 if (!genericTypeParameterBuilder.m_type.
IsCreated())
797 genericTypeParameterBuilder.m_type.
CreateType();
801 TypeBuilder.SetMethodImpl(m_module.GetNativeHandle(), num, m_dwMethodImplFlags);
810 CheckContext(parameterTypes);
811 SetSignature(
null,
null,
null, parameterTypes,
null,
null);
819 CheckContext(returnType);
831 public void SetSignature(
Type returnType,
Type[] returnTypeRequiredCustomModifiers,
Type[] returnTypeOptionalCustomModifiers,
Type[] parameterTypes,
Type[][] parameterTypeRequiredCustomModifiers,
Type[][] parameterTypeOptionalCustomModifiers)
833 if (m_tkMethod.
Token == 0)
835 CheckContext(returnType);
836 CheckContext(returnTypeRequiredCustomModifiers, returnTypeOptionalCustomModifiers, parameterTypes);
837 CheckContext(parameterTypeRequiredCustomModifiers);
838 CheckContext(parameterTypeOptionalCustomModifiers);
840 if (returnType !=
null)
842 m_returnType = returnType;
844 if (parameterTypes !=
null)
846 m_parameterTypes =
new Type[parameterTypes.Length];
847 Array.
Copy(parameterTypes, m_parameterTypes, parameterTypes.Length);
849 m_returnTypeRequiredCustomModifiers = returnTypeRequiredCustomModifiers;
850 m_returnTypeOptionalCustomModifiers = returnTypeOptionalCustomModifiers;
851 m_parameterTypeRequiredCustomModifiers = parameterTypeRequiredCustomModifiers;
852 m_parameterTypeOptionalCustomModifiers = parameterTypeOptionalCustomModifiers;
865 [SecuritySafeCritical]
873 m_containingType.ThrowIfCreated();
874 if (position > 0 && (m_parameterTypes ==
null || position > m_parameterTypes.Length))
885 [SecuritySafeCritical]
886 [Obsolete(
"An alternate API is available: Emit the MarshalAs custom attribute instead. http://go.microsoft.com/fwlink/?linkid=14202")]
890 m_containingType.ThrowIfCreated();
891 if (m_retParam ==
null)
905 m_containingType.ThrowIfCreated();
911 if (m_symCustomAttrs ==
null)
915 m_symCustomAttrs.Add(
new SymCustomAttr(name, data));
925 [SecuritySafeCritical]
937 m_containingType.ThrowIfCreated();
942 array = pset.EncodeXml();
945 TypeBuilder.AddDeclarativeSecurity(m_module.GetNativeHandle(), MetadataTokenInternal, action, array, cb);
973 m_containingType.ThrowIfCreated();
975 byte[] localSignature2 =
null;
978 byte[] array3 = (
byte[])il.Clone();
979 if (localSignature !=
null)
981 localSignature2 = (
byte[])localSignature.Clone();
983 if (exceptionHandlers !=
null)
985 array = ToArray(exceptionHandlers);
986 CheckExceptionHandlerRanges(array, array3.Length);
988 if (tokenFixups !=
null)
990 array2 = ToArray(tokenFixups);
991 int num = array3.Length - 4;
992 for (
int i = 0; i < array2.Length; i++)
994 if (array2[i] < 0 || array2[i] > num)
1001 m_localSignature = localSignature2;
1002 m_exceptions = array;
1003 m_mdMethodFixups = array2;
1004 m_maxStack = maxStack;
1005 m_ilGenerator =
null;
1011 T[] array = sequence as
T[];
1014 return (T[])array.Clone();
1019 private static void CheckExceptionHandlerRanges(ExceptionHandler[] exceptionHandlers,
int maxOffset)
1022 ExceptionHandler exceptionHandler;
1025 if (num < exceptionHandlers.Length)
1027 exceptionHandler = exceptionHandlers[num];
1028 if (exceptionHandler.m_filterOffset > maxOffset || exceptionHandler.m_tryEndOffset > maxOffset || exceptionHandler.m_handlerEndOffset > maxOffset)
1041 throw new ArgumentException(Environment.GetResourceString(
"Argument_InvalidTypeToken", exceptionHandler.ExceptionTypeToken),
"exceptionHandlers[" + num +
"]");
1056 m_containingType.ThrowIfCreated();
1057 if (il !=
null && (count < 0 || count > il.Length))
1066 m_ubBody =
new byte[count];
1068 m_localSignature =
null;
1069 m_exceptions =
null;
1070 m_mdMethodFixups =
null;
1078 [SecuritySafeCritical]
1082 m_containingType.ThrowIfCreated();
1083 m_dwMethodImplFlags = attributes;
1084 m_canBeRuntimeImpl =
true;
1085 TypeBuilder.SetMethodImpl(m_module.GetNativeHandle(), MetadataTokenInternal, attributes);
1094 ThrowIfShouldNotHaveBody();
1095 if (m_ilGenerator ==
null)
1099 return m_ilGenerator;
1109 ThrowIfShouldNotHaveBody();
1110 if (m_ilGenerator ==
null)
1114 return m_ilGenerator;
1117 private void ThrowIfShouldNotHaveBody()
1129 return GetModuleBuilder();
1138 [SecuritySafeCritical]
1146 if (binaryAttribute ==
null)
1154 ParseCA(con, binaryAttribute);
1163 [SecuritySafeCritical]
1166 if (customBuilder ==
null)
1171 customBuilder.CreateCustomAttribute(m_module, MetadataTokenInternal);
1172 if (IsKnownCA(customBuilder.m_con))
1174 ParseCA(customBuilder.m_con, customBuilder.m_blob);
1192 private void ParseCA(ConstructorInfo con,
byte[] blob)
1197 m_canBeRuntimeImpl =
true;
1201 m_canBeRuntimeImpl =
true;
1202 m_isDllImport =
true;
1211 throw new NotImplementedException();
1221 throw new NotImplementedException();
1233 throw new NotImplementedException();
1246 void _MethodBuilder.
Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid,
short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
1248 throw new NotImplementedException();
void SetMethodBody(byte[] il, int maxStack, byte[] localSignature, IEnumerable< ExceptionHandler > exceptionHandlers, IEnumerable< int > tokenFixups)
Creates the body of the method by using a specified byte array of Microsoft intermediate language (MS...
Performs reflection on a module.
Discovers the attributes of a parameter and provides access to parameter metadata.
Module GetModule()
Returns a reference to the module that contains this method.
MethodAttributes
Specifies flags for method attributes. These flags are defined in the corhdr.h file.
void SetImplementationFlags(MethodImplAttributes attributes)
Sets the implementation flags for this method.
static string NewLine
Gets the newline string defined for this environment.
The T:System.Diagnostics.SymbolStore.SymbolToken structure is an object representation of a token tha...
Type CreateType()
Creates a T:System.Type object for the class. After defining fields and methods on the class,...
The exception that is thrown when a null reference (Nothing in Visual Basic) is passed to a method th...
void SetSignature(Type returnType, Type[] returnTypeRequiredCustomModifiers, Type[] returnTypeOptionalCustomModifiers, Type[] parameterTypes, Type[][] parameterTypeRequiredCustomModifiers, Type[][] parameterTypeOptionalCustomModifiers)
Sets the method signature, including the return type, the parameter types, and the required and optio...
void AddDeclarativeSecurity(SecurityAction action, PermissionSet pset)
Adds declarative security to this method.
override ParameterInfo ReturnParameter
Gets a T:System.Reflection.ParameterInfo object that contains information about the return type of th...
void SetCustomAttribute(CustomAttributeBuilder customBuilder)
Sets a custom attribute using a custom attribute builder.
Defines and creates generic type parameters for dynamically defined generic types and methods....
unsafe override string ToString()
Converts the value of this instance to a T:System.String.
override bool IsDefined(Type attributeType, bool inherit)
Checks if the specified custom attribute type is defined.
MethodImplAttributes
Specifies flags for the attributes of a method implementation.
MethodToken GetToken()
Returns the MethodToken that represents the token for this method.
GenericTypeParameterBuilder [] DefineGenericParameters(params string[] names)
Sets the number of generic type parameters for the current method, specifies their names,...
Discovers the attributes of a method and provides access to method metadata.
override string Name
Retrieves the name of this method.
void SetCustomAttribute(ConstructorInfo con, byte[] binaryAttribute)
Sets a custom attribute using a specified custom attribute blob.
void GetIDsOfNames([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
Maps a set of names to a corresponding set of dispatch identifiers.
ILGenerator GetILGenerator(int size)
Returns an ILGenerator for this method with the specified Microsoft intermediate language (MSIL) stre...
Discovers the attributes of a class constructor and provides access to constructor metadata.
The MethodToken struct is an object representation of a token that represents a method.
BindingFlags
Specifies flags that control binding and the way in which the search for members and types is conduct...
void SetSymCustomAttribute(string name, byte[] data)
Set a symbolic custom attribute using a blob.
The exception that is thrown when the value of an argument is outside the allowable range of values a...
virtual MethodInfo MakeGenericMethod(params Type[] typeArguments)
Substitutes the elements of an array of types for the type parameters of the current generic method d...
override bool Equals(object obj)
Determines whether the given object is equal to this instance.
void CreateMethodBody(byte[] il, int count)
Creates the body of the method using a supplied byte array of Microsoft intermediate language (MSIL) ...
CallingConvention
Specifies the calling convention required to call methods implemented in unmanaged code.
override Type DeclaringType
Gets the type that declares the current nested type or generic type parameter.
override bool IsSecurityTransparent
Throws a T:System.NotSupportedException in all cases.
string Signature
Retrieves the signature of the method.
Exposes the enumerator, which supports a simple iteration over a collection of a specified type....
Provides methods for building signatures.
void OpenMethod(SymbolToken method)
Opens a method to place symbol information into.
Helps build custom attributes.
override ParameterInfo [] GetParameters()
Returns the parameters of this method.
Creates or associates parameter information.
override bool Equals(object obj)
Checks if this instance is equal to the given object.
MethodToken GetConstructorToken(ConstructorInfo constructor, IEnumerable< Type > optionalParameterTypes)
Returns the token used to identify the constructor that has the specified attributes and parameter ty...
Generates Microsoft intermediate language (MSIL) instructions.
override object [] GetCustomAttributes(bool inherit)
Returns all the custom attributes defined for this method.
void SetReturnType(Type returnType)
Sets the return type of the method.
void GetTypeInfo(uint iTInfo, uint lcid, IntPtr ppTInfo)
Retrieves the type information for an object, which can be used to get the type information for an in...
CallingConventions
Defines the valid calling conventions for a method.
SecurityAction
Specifies the security actions that can be performed using declarative security.
void CloseScope(int endOffset)
Closes the current lexical scope.
Provides information about, and means to manipulate, the current environment and platform....
static bool IsDefined(Type enumType, object value)
Returns an indication whether a constant with a specified value exists in a specified enumeration.
T:System.RuntimeMethodHandle is a handle to the internal metadata representation of a method.
StringBuilder Append(char value, int repeatCount)
Appends a specified number of copies of the string representation of a Unicode character to this inst...
Represents a collection that can contain many different types of permissions.
Defines and creates new instances of classes during run time.
Indicates that the attributed method is exposed by an unmanaged dynamic-link library (DLL) as a stati...
override bool IsSecuritySafeCritical
Throws a T:System.NotSupportedException in all cases.
void SetMarshal(UnmanagedMarshal unmanagedMarshal)
Sets marshaling information for the return type of this method.
Provides the base class for enumerations.
override object [] GetCustomAttributes(Type attributeType, bool inherit)
Returns the custom attributes identified by the given type.
override Type ReflectedType
Retrieves the class that was used in reflection to obtain this object.
override Module Module
Retrieves the dynamic module that contains this type definition.
bool IsEmpty()
Gets a value indicating whether the T:System.Security.PermissionSet is empty.
virtual ParameterInfo ReturnParameter
Gets a T:System.Reflection.ParameterInfo object that contains information about the return type of th...
Defines and represents a module in a dynamic assembly.
Specifies the details of how a method is implemented. This class cannot be inherited.
override ICustomAttributeProvider ReturnTypeCustomAttributes
Returns the custom attributes of the method's return type.
override bool IsSecurityCritical
Throws a T:System.NotSupportedException in all cases.
ILGenerator GetILGenerator()
Returns an ILGenerator for this method with a default Microsoft intermediate language (MSIL) stream s...
override MethodAttributes Attributes
Retrieves the attributes for this method.
override MethodInfo MakeGenericMethod(params Type[] typeArguments)
Returns a generic method constructed from the current generic method definition using the specified g...
Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the ba...
Represents type declarations: class types, interface types, array types, value types,...
override string ToString()
Returns this MethodBuilder instance as a string.
override bool IsGenericMethodDefinition
Gets a value indicating whether the current T:System.Reflection.Emit.MethodBuilder object represents ...
ParameterAttributes
Defines the attributes that can be associated with a parameter. These are defined in CorHdr....
override bool IsGenericMethod
Gets a value indicating whether the method is a generic method.
override MethodImplAttributes GetMethodImplementationFlags()
Returns the implementation flags for the method.
override Type ReturnType
Gets the return type of the method represented by this T:System.Reflection.Emit.MethodBuilder.
Selects a member from a list of candidates, and performs type conversion from actual argument type to...
TypeAttributes
Specifies type attributes.
Defines and represents a method (or constructor) on a dynamic class.
Represents a mutable string of characters. This class cannot be inherited.To browse the ....
Type DeclaringType
Provides COM objects with version-independent access to the P:System.Reflection.MemberInfo....
override string ToString()
Returns a string representing the signature arguments.
The exception that is thrown when one of the arguments provided to a method is not valid.
Represents the class that describes how to marshal a field from managed to unmanaged code....
static void Copy(Array sourceArray, Array destinationArray, int length)
Copies a range of elements from an T:System.Array starting at the first element and pastes them into ...
override object Invoke(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, CultureInfo culture)
Dynamically invokes the method reflected by this instance on the given object, passing along the spec...
Represents a symbol writer for managed code.
Represents an exception handler in a byte array of IL to be passed to a method such as M:System....
static MethodInfo GetMethod(Type type, MethodInfo method)
Returns the method of the specified constructed generic type that corresponds to the specified method...
int Token
Returns the metadata token for this method.
ISymbolWriter GetSymWriter()
Returns the symbol writer associated with this dynamic module.
override Type DeclaringType
Returns the type that declares this method.
ParameterBuilder DefineParameter(int position, ParameterAttributes attributes, string strParamName)
Sets the parameter attributes and the name of a parameter of this method, or of the return value of t...
override Type [] GetGenericArguments()
Returns an array of T:System.Reflection.Emit.GenericTypeParameterBuilder objects that represent the t...
void CloseMethod()
Closes the current method.
void Invoke(uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
Provides access to properties and methods exposed by an object.
override MethodInfo GetBaseDefinition()
Return the base implementation for a method.
The exception that is thrown when a method call is invalid for the object's current state.
static SignatureHelper GetMethodSigHelper(Module mod, Type returnType, Type[] parameterTypes)
Returns a signature helper for a method with a standard calling convention, given the method's module...
ClassInterfaceType
Identifies the type of class interface that is generated for a class.
int OpenScope(int startOffset)
Opens a new lexical scope in the current method.
override RuntimeMethodHandle MethodHandle
Retrieves the internal handle for the method. Use this handle to access the underlying metadata handl...
void GetTypeInfoCount(out uint pcTInfo)
Retrieves the number of type information interfaces that an object provides (either 0 or 1).
ExceptionHandlingClauseOptions
Identifies kinds of exception-handling clauses.
Provides information about a specific culture (called a locale for unmanaged code development)....
The exception that is thrown when an invoked method is not supported, or when there is an attempt to ...
Exposes the T:System.Reflection.Emit.MethodBuilder class to unmanaged code.
virtual void SetMarshal(UnmanagedMarshal unmanagedMarshal)
Specifies the marshaling for this parameter.
bool InitLocals
Gets or sets a Boolean value that specifies whether the local variables in this method are zero initi...
T [] ToArray()
Copies the elements of the T:System.Collections.Generic.List`1 to a new array.
bool IsCreated()
Returns a value that indicates whether the current dynamic type has been created.
override int GetHashCode()
Gets the hash code for this method.
override MethodInfo GetGenericMethodDefinition()
Returns this method.
override bool ContainsGenericParameters
Not supported for this type.
void SetParameters(params Type[] parameterTypes)
Sets the number and types of parameters for a method.
Provides custom attributes for reflection objects that support them.
abstract ParameterInfo [] GetParameters()
When overridden in a derived class, gets the parameters of the specified method or constructor.