MethodBase Class

July 28, 2014

Provides information about methods and constructors.

Namespace:  System.Reflection
Assembly:  mscorlib (in mscorlib.dll)

public abstract class MethodBase : MemberInfo

The MethodBase type exposes the following members.

  NameDescription
Public propertyAttributesGets the attributes associated with this method.
Public propertyCallingConventionGets a value that indicates the calling conventions for this method.
Public propertyContainsGenericParametersGets a value that indicates whether the generic method contains unassigned generic type parameters.
Public propertyCustomAttributesGets a collection that contains this member's custom attributes. (Inherited from MemberInfo.)
Public propertyDeclaringTypeGets the class that declares this member. (Inherited from MemberInfo.)
Public propertyIsAbstractGets a value that indicates whether the method is abstract (MustInherit in Visual Basic).
Public propertyIsAssemblyGets a value that indicates whether the potential visibility of this method or constructor is described by 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 propertyIsConstructorGets a value that indicates whether the method is a constructor.
Public propertyIsFamilyGets a value that indicates whether the visibility of this method or constructor is described by MethodAttributes.Family; that is, the method or constructor is visible only within its class and derived classes.
Public propertyIsFamilyAndAssemblyGets a value that indicates whether the visibility of this method or constructor is described by MethodAttributes.FamANDAssem; that is, the method or constructor can be called by derived classes, but only if they are in the same assembly.
Public propertyIsFamilyOrAssemblyGets a value that indicates whether the potential visibility of this method or constructor is described by 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 propertyIsFinalGets a value that indicates whether this method is final (NotOverridable in Visual Basic).
Public propertyIsGenericMethodGets a value that indicates whether the method is generic.
Public propertyIsGenericMethodDefinitionGets a value that indicates whether the method is a generic method definition.
Public propertyIsHideBySigGets a value that indicates whether only a member of the same kind with exactly the same signature is hidden in the derived class.
Public propertyIsPrivateGets a value that indicates whether this member is private.
Public propertyIsPublicGets a value that indicates whether this is a public method.
Public propertyIsSpecialNameGets a value that indicates whether this method has a special name.
Public propertyIsStaticGets a value that indicates whether the method is static (Shared in Visual Basic).
Public propertyIsVirtualGets a value that indicates whether the method is virtual (Overridable in Visual Basic).
Public propertyMemberTypeWhen overridden in a derived class, gets a MemberTypes value indicating the type of the member — method, constructor, event, and so on. (Inherited from MemberInfo.)
Public propertyMetadataTokenGets a value that identifies a metadata element. (Inherited from MemberInfo.)
Public propertyMethodHandleGets a handle to the internal metadata representation of a method.
Public propertyMethodImplementationFlagsGets the MethodImplAttributes flags that specify the attributes of a method implementation.
Public propertyModuleGets the module in which the type that declares the member represented by the current MemberInfo is defined. (Inherited from MemberInfo.)
Public propertyNameGets the name of the current member. (Inherited from MemberInfo.)
Public propertyReflectedTypeGets the class object that was used to obtain this instance of MemberInfo. (Inherited from MemberInfo.)
Top

  NameDescription
Public methodEqualsReturns a value that indicates whether this instance is equal to a specified object. (Overrides MemberInfo.Equals(Object).)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodStatic memberGetCurrentMethodReturns a MethodBase object that represents the currently executing method.
Public methodGetCustomAttributes(Boolean)When overridden in a derived class, returns an array of all custom attributes applied to this member. (Inherited from MemberInfo.)
Public methodGetCustomAttributes(Type, Boolean)When overridden in a derived class, returns an array of custom attributes applied to this member and identified by Type. (Inherited from MemberInfo.)
Public methodGetGenericArgumentsReturns an array of Type objects that represent the type arguments of a generic method or the type parameters of a generic method definition.
Public methodGetHashCodeReturns the hash code for this instance. (Overrides MemberInfo.GetHashCode().)
Public methodStatic memberGetMethodFromHandle(RuntimeMethodHandle)Gets method information for the method that is represented by the specified handle.
Public methodStatic memberGetMethodFromHandle(RuntimeMethodHandle, RuntimeTypeHandle)Gets the constructor or method represented by the specified handle, for the specified generic type.
Public methodGetMethodImplementationFlagsWhen overridden in a derived class, returns the MethodImplAttributes flags.
Public methodGetParametersWhen overridden in a derived class, gets the parameters of this method or constructor.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInvoke(Object, Object[])Invokes the method or constructor represented by the current instance, using the specified parameters.
Public methodInvoke(Object, BindingFlags, Binder, Object[], CultureInfo)When overridden in a derived class, invokes the reflected method or constructor with the given parameters.
Public methodIsDefinedWhen 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. (Inherited from MemberInfo.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

  NameDescription
Public Extension MethodGetCustomAttribute(Type)Overloaded. Retrieves a custom attribute of a specified type that is applied to a specified member. (Defined by CustomAttributeExtensions.)
Public Extension MethodGetCustomAttribute(Type, Boolean)Overloaded. Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member. (Defined by CustomAttributeExtensions.)
Public Extension MethodGetCustomAttribute<T>()Overloaded. Retrieves a custom attribute of a specified type that is applied to a specified member. (Defined by CustomAttributeExtensions.)
Public Extension MethodGetCustomAttribute<T>(Boolean)Overloaded. Retrieves a custom attribute of a specified type that is applied to a specified member, and optionally inspects the ancestors of that member. (Defined by CustomAttributeExtensions.)
Public Extension MethodGetCustomAttributes()Overloaded. Retrieves a collection of custom attributes that are applied to a specified member. (Defined by CustomAttributeExtensions.)
Public Extension MethodGetCustomAttributes(Type)Overloaded. Retrieves a collection of custom attributes of a specified type that are applied to a specified member. (Defined by CustomAttributeExtensions.)
Public Extension MethodGetCustomAttributes<T>()Overloaded. Retrieves a collection of custom attributes of a specified type that are applied to a specified member. (Defined by CustomAttributeExtensions.)
Public Extension MethodGetCustomAttributes<T>(Boolean)Overloaded. Retrieves a collection of custom attributes of a specified type that are applied to a specified member, and optionally inspects the ancestors of that member. (Defined by CustomAttributeExtensions.)
Public Extension MethodIsDefinedIndicates whether custom attributes of a specified type are applied to a specified member. (Defined by CustomAttributeExtensions.)
Top

MethodBase is the base class of MethodInfo and ConstructorInfo.

Windows Phone applications cannot create classes that inherit from the MethodBase class.

Windows Phone OS

Supported in: 8.1, 8.0, 7.1, 7.0

Windows Phone

This type is thread safe.

Show:
© 2014 Microsoft