System.Type.GetMethods Method

Returns all the public methods of the current Type.

Syntax

public System.Reflection.MethodInfo[] GetMethods ()

Returns

An array of System.Reflection.MethodInfo objects representing all the public methods defined for the current Type.

-or-

An empty array of type System.Reflection.MethodInfo, if no public methods are defined for the current Type.

Remarks

The Type.GetMethods method does not return methods in a particular order, such as alphabetical or declaration order. Your code must not depend on the order in which methods are returned, because that order varies.

Constructors are not included in the array of methods returned by this call. Make a separate call to GetConstructors() to get the constructor methods.

The following table shows what members of a base class are returned by the Get methods when reflecting on a type.

Constructor

No

No

Field

No

Yes. A field is always hide-by-name-and-signature.

Event

Not applicable

The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

Method

No

Yes. A method (both virtual and non-virtual) can be hide-by-name or hide-by-name-and-signature.

Nested Type

No

No

Property

Not applicable

The common type system rule is that the inheritance is the same as that of the methods that implement the property. Reflection treats properties as hide-by-name-and-signature. See note 2 below.

[The 'ordered' type of list has not been implemented in the ECMA stylesheet.]
Note:

You cannot omit parameters when looking up constructors and methods. You can only omit parameters when invoking.

If the current T:System.Type represents a constructed generic type, this method returns the System.Reflection.MethodInfo objects with the type parameters replaced by the appropriate type arguments.

If the current Type represents a type parameter in the definition of a generic type or generic method, this method searches the methods of the class constraint, or the methods of object if there is no class constraint.

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0