Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class System.​Reflection.​MethodBase

Assembly: System.Runtime

Inheritance: object → MemberInfo → MethodBase

Implemented Interfaces

Provides information about methods and constructors.

Properties

Attributes
Gets the attributes associated with this method.
CallingConvention
Gets a value indicating the calling conventions for this method.
public bool
ContainsGenericParameters
Gets a value indicating whether the generic method contains unassigned generic type parameters.
public bool
IsAbstract
Gets a value indicating whether the method is abstract.
public bool
IsAssembly
Gets a value indicating whether the potential visibility of this method or constructor is described by <see cref="F:System.Reflection.MethodAttributes.Assembly" /> ; that is, the method or constructor is visible at most to other types in the same assembly, and is not visible to derived types outside the assembly.
public bool
IsConstructedGenericMethod
public bool
IsConstructor
Gets a value indicating whether the method is a constructor.
public bool
IsFamily
Gets a value indicating whether the visibility of this method or constructor is described by <see cref="F:System.Reflection.MethodAttributes.Family" /> ; that is, the method or constructor is visible only within its class and derived classes.
public bool
IsFamilyAndAssembly
Gets a value indicating whether the visibility of this method or constructor is described by <see cref="F:System.Reflection.MethodAttributes.FamANDAssem" /> ; that is, the method or constructor can be called by derived classes, but only if they are in the same assembly.
public bool
IsFamilyOrAssembly
Gets a value indicating whether the potential visibility of this method or constructor is described by <see cref="F:System.Reflection.MethodAttributes.FamORAssem" /> ; that is, the method or constructor can be called by derived classes wherever they are, and by classes in the same assembly.
public bool
IsFinal
Gets a value indicating whether this method is <see langword="final" /> .
public bool
IsGenericMethod
Gets a value indicating whether the method is generic.
public bool
IsGenericMethodDefinition
Gets a value indicating whether the method is a generic method definition.
public bool
IsHideBySig
Gets a value indicating whether only a member of the same kind with exactly the same signature is hidden in the derived class.
public bool
IsPrivate
Gets a value indicating whether this member is private.
public bool
IsPublic
Gets a value indicating whether this is a public method.
public bool
IsSecurityCritical
Gets a value that indicates whether the current method or constructor is security-critical or security-safe-critical at the current trust level, and therefore can perform critical operations.
public bool
IsSecuritySafeCritical
Gets a value that indicates whether the current method or constructor is security-safe-critical at the current trust level; that is, whether it can perform critical operations and can be accessed by transparent code.
public bool
IsSecurityTransparent
Gets a value that indicates whether the current method or constructor is transparent at the current trust level, and therefore cannot perform critical operations.
public bool
IsSpecialName
Gets a value indicating whether this method has a special name.
public bool
IsStatic
Gets a value indicating whether the method is <see langword="static" /> .
public bool
IsVirtual
Gets a value indicating whether the method is <see langword="virtual" /> .
MethodHandle
Gets a handle to the internal metadata representation of a method.
MethodImplementationFlags
Gets the <see cref="T:System.Reflection.MethodImplAttributes" /> flags that specify the attributes of a method implementation.
Gets a collection that contains this member's custom attributes.
public Type
DeclaringType
Gets the class that declares this member.
public bool
IsCollectible
Gets a value that indicates whether this <see cref="T:System.Reflection.MemberInfo" /> object references one or more assemblies held in a collectible <see cref="T:System.Runtime.Loader.AssemblyLoadContext" /> .
public MemberTypes
MemberType
When overridden in a derived class, gets a <see cref="T:System.Reflection.MemberTypes" /> value indicating the type of the member - method, constructor, event, and so on.
public int
MetadataToken
Gets a value that identifies a metadata element.
public Module
Module
Gets the module in which the type that declares the member represented by the current <see cref="T:System.Reflection.MemberInfo" /> is defined.
public string
Name
Gets the name of the current member.
public Type
ReflectedType
Gets the class object that was used to obtain this instance of <see langword="MemberInfo" /> .

Methods

public bool
Equals​(object obj)
Returns a value that indicates whether this instance is equal to a specified object.
Returns <see langword="true" /> if <paramref name="obj" /> equals the type and value of this instance; otherwise, <see langword="false" /> .
obj An object to compare with this instance, or <see langword="null" /> .
public static MethodBase
GetCurrentMethod​()
Returns a <see langword="MethodBase" /> object representing the currently executing method.
Returns <see cref="M:System.Reflection.MethodBase.GetCurrentMethod" /> is a static method that is called from within an executing method and that returns information about that method. A <see langword="MethodBase" /> object representing the currently executing method.
public Type[]
GetGenericArguments​()
Returns an array of <see cref="T:System.Type" /> objects that represent the type arguments of a generic method or the type parameters of a generic method definition.
Returns An array of <see cref="T:System.Type" /> objects that represent the type arguments of a generic method or the type parameters of a generic method definition. Returns an empty array if the current method is not a generic method.
public int
GetHashCode​()
Returns the hash code for this instance.
Returns A 32-bit signed integer hash code.
public MethodBody
GetMethodBody​()
When overridden in a derived class, gets a <see cref="T:System.Reflection.MethodBody" /> object that provides access to the MSIL stream, local variables, and exceptions for the current method.
Returns A <see cref="T:System.Reflection.MethodBody" /> object that provides access to the MSIL stream, local variables, and exceptions for the current method.
public static MethodBase
GetMethodFromHandle​(RuntimeMethodHandle handle)
Gets method information by using the method's internal metadata representation (handle).
Returns A <see langword="MethodBase" /> containing information about the method.
handle The method's handle.
public static MethodBase
GetMethodFromHandle​(RuntimeMethodHandle handle, RuntimeTypeHandle declaringType)
Gets a <see cref="T:System.Reflection.MethodBase" /> object for the constructor or method represented by the specified handle, for the specified generic type.
Returns A <see cref="T:System.Reflection.MethodBase" /> object representing the method or constructor specified by <paramref name="handle" /> , in the generic type specified by <paramref name="declaringType" /> .
handle A handle to the internal metadata representation of a constructor or method.
declaringType A handle to the generic type that defines the constructor or method.
GetMethodImplementationFlags​()
When overridden in a derived class, returns the <see cref="T:System.Reflection.MethodImplAttributes" /> flags.
Returns The <see langword="MethodImplAttributes" /> flags.
public ParameterInfo[]
GetParameters​()
When overridden in a derived class, gets the parameters of the specified method or constructor.
Returns An array of type <see langword="ParameterInfo" /> containing information that matches the signature of the method (or constructor) reflected by this <see langword="MethodBase" /> instance.
public object
Invoke​(object obj, object[] parameters)
Invokes the method or constructor represented by the current instance, using the specified parameters.
Returns An object containing the return value of the invoked method, or <see langword="null" /> in the case of a constructor.
obj The object on which to invoke the method or constructor. If a method is static, this argument is ignored. If a constructor is static, this argument must be <see langword="null" /> or an instance of the class that defines the constructor.
parameters An argument list for the invoked method or constructor. This is an array of objects with the same number, order, and type as the parameters of the method or constructor to be invoked. If there are no parameters, <paramref name="parameters" /> should be <see langword="null" /> . If the method or constructor represented by this instance takes a <see langword="ref" /> parameter ( <see langword="ByRef" /> in Visual Basic), no special attribute is required for that parameter in order to invoke the method or constructor using this function. Any object in this array that is not explicitly initialized with a value will contain the default value for that object type. For reference-type elements, this value is <see langword="null" /> . For value-type elements, the default value is 0, 0.0, or <see langword="false" /> , depending on the specific element type.
public object
Invoke​(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, Globalization.​CultureInfo culture)
When overridden in a derived class, invokes the reflected method or constructor with the given parameters.
Returns An <see langword="Object" /> containing the return value of the invoked method, or <see langword="null" /> in the case of a constructor, or <see langword="null" /> if the method's return type is <see langword="void" /> . Before calling the method or constructor, <see langword="Invoke" /> checks to see if the user has access permission and verifies that the parameters are valid.
obj The object on which to invoke the method or constructor. If a method is static, this argument is ignored. If a constructor is static, this argument must be <see langword="null" /> or an instance of the class that defines the constructor.
invokeAttr A bitmask that is a combination of 0 or more bit flags from <see cref="T:System.Reflection.BindingFlags" /> .
binder An object that enables the binding, coercion of argument types, invocation of members, and retrieval of <see langword="MemberInfo" /> objects via reflection. If <paramref name="binder" /> is <see langword="null" /> , the default binder is used.
parameters An argument list for the invoked method or constructor. This is an array of objects with the same number, order, and type as the parameters of the method or constructor to be invoked. If there are no parameters, this should be <see langword="null" /> . If the method or constructor represented by this instance takes a ByRef parameter, there is no special attribute required for that parameter in order to invoke the method or constructor using this function. Any object in this array that is not explicitly initialized with a value will contain the default value for that object type. For reference-type elements, this value is <see langword="null" /> . For value-type elements, this value is 0, 0.0, or <see langword="false" /> , depending on the specific element type.
culture An instance of <see langword="CultureInfo" /> used to govern the coercion of types. If this is <see langword="null" /> , the <see cref="T:System.Globalization.CultureInfo" /> for the current thread is used. (This is necessary to convert a string that represents 1000 to a <see cref="T:System.Double" /> value, for example, since 1000 is represented differently by different cultures.)
public object[]
GetCustomAttributes​(bool inherit)
Inherited from MemberInfo
When overridden in a derived class, returns an array of all custom attributes applied to this member.
Returns An array that contains all the custom attributes applied to this member, or an array with zero elements if no attributes are defined.
inherit <see langword="true" /> to search this member's inheritance chain to find the attributes; otherwise, <see langword="false" /> . This parameter is ignored for properties and events.
public object[]
GetCustomAttributes​(Type attributeType, bool inherit)
Inherited from MemberInfo
When overridden in a derived class, returns an array of custom attributes applied to this member and identified by <see cref="T:System.Type" /> .
Returns An array of custom attributes applied to this member, or an array with zero elements if no attributes assignable to <paramref name="attributeType" /> have been applied.
attributeType The type of attribute to search for. Only attributes that are assignable to this type are returned.
inherit <see langword="true" /> to search this member's inheritance chain to find the attributes; otherwise, <see langword="false" /> . This parameter is ignored for properties and events.
GetCustomAttributesData​()
Inherited from MemberInfo
Returns a list of <see cref="T:System.Reflection.CustomAttributeData" /> objects representing data about the attributes that have been applied to the target member.
Returns A generic list of <see cref="T:System.Reflection.CustomAttributeData" /> objects representing data about the attributes that have been applied to the target member.
public bool
HasSameMetadataDefinitionAs​(MemberInfo other)
Inherited from MemberInfo
public bool
IsDefined​(Type attributeType, bool inherit)
Inherited from MemberInfo
When overridden in a derived class, indicates whether one or more attributes of the specified type or of its derived types is applied to this member.
Returns <see langword="true" /> if one or more instances of <paramref name="attributeType" /> or any of its derived types is applied to this member; otherwise, <see langword="false" /> .
attributeType The type of custom attribute to search for. The search includes derived types.
inherit <see langword="true" /> to search this member's inheritance chain to find the attributes; otherwise, <see langword="false" /> . This parameter is ignored for properties and events.
protected void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .
public string
ToString​()
Inherited from object
Returns a string that represents the current object.
Returns A string that represents the current object.