MethodInfo Class
Microsoft Silverlight will reach end of support after October 2021. Learn more.
Discovers the attributes of a method and provides access to method metadata.
Inheritance Hierarchy
System.Object
System.Reflection.MemberInfo
System.Reflection.MethodBase
System.Reflection.MethodInfo
System.Reflection.Emit.DynamicMethod
System.Reflection.Emit.MethodBuilder
Namespace: System.Reflection
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
<ClassInterfaceAttribute(ClassInterfaceType.None)> _
<ComVisibleAttribute(True)> _
Public MustInherit Class MethodInfo _
Inherits MethodBase
[ClassInterfaceAttribute(ClassInterfaceType.None)]
[ComVisibleAttribute(true)]
public abstract class MethodInfo : MethodBase
The MethodInfo type exposes the following members.
Properties
Name | Description | |
---|---|---|
Attributes | Gets the attributes associated with this method. (Inherited from MethodBase.) | |
CallingConvention | Gets a value that indicates the calling conventions for this method. (Inherited from MethodBase.) | |
ContainsGenericParameters | Gets a value that indicates whether the generic method contains unassigned generic type parameters. (Inherited from MethodBase.) In Silverlight for Windows Phone, this member is overridden by ContainsGenericParameters. In XNA Framework, this member is overridden by ContainsGenericParameters. |
|
DeclaringType | Gets the class that declares this member. (Inherited from MemberInfo.) | |
IsAbstract | Gets a value that indicates whether the method is abstract (MustInherit in Visual Basic). (Inherited from MethodBase.) | |
IsAssembly | Gets 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. (Inherited from MethodBase.) | |
IsConstructor | Gets a value that indicates whether the method is a constructor. (Inherited from MethodBase.) | |
IsFamily | Gets 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. (Inherited from MethodBase.) | |
IsFamilyAndAssembly | Gets 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. (Inherited from MethodBase.) | |
IsFamilyOrAssembly | Gets 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. (Inherited from MethodBase.) | |
IsFinal | Gets a value that indicates whether this method is final (NotOverridable in Visual Basic). (Inherited from MethodBase.) | |
IsGenericMethod | Gets a value that indicates whether the method is generic. (Inherited from MethodBase.) In Silverlight for Windows Phone, this member is overridden by IsGenericMethod. In XNA Framework, this member is overridden by IsGenericMethod. |
|
IsGenericMethodDefinition | Gets a value that indicates whether the method is a generic method definition. (Inherited from MethodBase.) In Silverlight for Windows Phone, this member is overridden by IsGenericMethodDefinition. In XNA Framework, this member is overridden by IsGenericMethodDefinition. |
|
IsHideBySig | Gets a value that indicates whether only a member of the same kind with exactly the same signature is hidden in the derived class. (Inherited from MethodBase.) | |
IsPrivate | Gets a value that indicates whether this member is private. (Inherited from MethodBase.) | |
IsPublic | Gets a value that indicates whether this is a public method. (Inherited from MethodBase.) | |
IsSpecialName | Gets a value that indicates whether this method has a special name. (Inherited from MethodBase.) | |
IsStatic | Gets a value that indicates whether the method is static (Shared in Visual Basic). (Inherited from MethodBase.) | |
IsVirtual | Gets a value that indicates whether the method is virtual (Overridable in Visual Basic). (Inherited from MethodBase.) | |
MemberType | Gets a MemberTypes value indicating that this member is a method. (Overrides MemberInfo.MemberType.) | |
MetadataToken | Gets a value that identifies a metadata element. (Inherited from MemberInfo.) | |
MethodHandle | Gets a handle to the internal metadata representation of a method. (Inherited from MethodBase.) | |
Module | Gets the module in which the type that declares the member represented by the current MemberInfo is defined. (Inherited from MemberInfo.) | |
Name | Gets the name of the current member. (Inherited from MemberInfo.) | |
ReflectedType | Gets the class object that was used to obtain this instance of MemberInfo. (Inherited from MemberInfo.) | |
ReturnParameter | Gets a ParameterInfo object that contains information about the return type of the method, such as whether the return type has custom modifiers. | |
ReturnType | Gets the return type of this method. | |
ReturnTypeCustomAttributes | Gets the custom attributes for the return type. |
Top
Methods
Name | Description | |
---|---|---|
CreateDelegate(Type) | Creates a delegate of the specified type from this method. | |
CreateDelegate(Type, Object) | Creates a delegate of the specified type with the specified target from this method. | |
Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) | |
GetBaseDefinition | When overridden in a derived class, returns the MethodInfo object for the method on the direct or indirect base class in which the method represented by this instance was first declared. | |
GetCustomAttributes(Boolean) | When overridden in a derived class, returns an array of all custom attributes applied to this member. (Inherited from MemberInfo.) | |
GetCustomAttributes(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.) | |
GetGenericArguments | Returns an array of Type objects that represent the type arguments of a generic method or the type parameters of a generic method definition. (Overrides MethodBase.GetGenericArguments().) | |
GetGenericMethodDefinition | Returns a MethodInfo object that represents a generic method definition from which the current method can be constructed. | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetMethodImplementationFlags | When overridden in a derived class, returns the MethodImplAttributes flags. (Inherited from MethodBase.) | |
GetParameters | When overridden in a derived class, gets the parameters of this method or constructor. (Inherited from MethodBase.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
Invoke(Object, array<Object[]) | Invokes the method or constructor represented by the current instance, using the specified parameters. (Inherited from MethodBase.) | |
Invoke(Object, BindingFlags, Binder, array<Object[], CultureInfo) | When overridden in a derived class, invokes the reflected method or constructor with the given parameters. (Inherited from MethodBase.) | |
IsDefined | 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. (Inherited from MemberInfo.) | |
MakeGenericMethod | Substitutes the elements of an array of types for the type parameters of the current generic method definition, and returns a MethodInfo object representing the resulting constructed method. | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Remarks
Instances of MethodInfo are obtained by calling the GetMethods or GetMethod method of a Type object or of an object that derives from Type, or by calling the MakeGenericMethod method of a MethodInfo that represents a generic method definition.
For a list of the invariant conditions for terms specific to generic methods, see the IsGenericMethod property. For a list of the invariant conditions for other terms used in generic reflection, see the Type.IsGenericType property.
In Silverlight-based applications, you cannot derive new types from MethodInfo.
Version Information
Silverlight
Supported in: 5, 4, 3
Silverlight for Windows Phone
Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0
XNA Framework
Supported in: Xbox 360, Windows Phone OS 7.0
Platforms
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Thread Safety
This type is thread safe.