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

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.
CustomAttributes
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)
obj An object to compare with this instance, or <see langword="null" /> .
Returns <see langword="true" /> if <paramref name="obj" /> equals the type and value of this instance; otherwise, <see langword="false" /> .
Returns a value that indicates whether this instance is equal to a specified object.
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 empty array if the current method is not a generic method.
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.
public int
GetHashCode​()
Returns A 32-bit signed integer hash code.
Returns the hash code for this instance.
public MethodBody
GetMethodBody​()
Returns A <see cref="T:System.Reflection.MethodBody" /> object that provides access to the MSIL stream, local variables, and exceptions for the current method.
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.
GetMethodImplementationFlags​()
Returns The <see langword="MethodImplAttributes" /> flags.
When overridden in a derived class, returns the <see cref="T:System.Reflection.MethodImplAttributes" /> flags.
public ParameterInfo[]
GetParameters​()
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.
When overridden in a derived class, gets the parameters of the specified method or constructor.
public object
Invoke​(object obj, object[] parameters)
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.
Returns An object containing the return value of the invoked method, or <see langword="null" /> in the case of a constructor.
Invokes the method or constructor represented by the current instance, using the specified parameters.
public object
Invoke​(object obj, BindingFlags invokeAttr, Binder binder, object[] parameters, Globalization.CultureInfo culture)
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.)
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.
When overridden in a derived class, invokes the reflected method or constructor with the given parameters.
public object[]
GetCustomAttributes​(bool inherit)
Inherited from MemberInfo
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.
Returns An array that contains all the custom attributes applied to this member, or an array with zero elements if no attributes are defined.
When overridden in a derived class, returns an array of all custom attributes applied to this member.
public object[]
GetCustomAttributes​(Type attributeType, bool inherit)
Inherited from MemberInfo
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.
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.
When overridden in a derived class, returns an array of custom attributes applied to this member and identified by <see cref="T:System.Type" /> .
GetCustomAttributesData​()
Inherited from MemberInfo
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.
Returns a 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
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.
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" /> .
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.
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
Returns The exact runtime type of the current instance.
Gets the <see cref="T:System.Type" /> of the current instance.
protected object
MemberwiseClone​()
Inherited from object
Returns A shallow copy of the current <see cref="T:System.Object" /> .
Creates 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.