相关文章推荐
纯真的足球  ·  Java泛型枚举注解详解·  1 周前    · 
不开心的椰子  ·  MethodInfo 类 ...·  昨天    · 
独立的汉堡包  ·  c++ 超时机制-掘金·  1 年前    · 
近视的卡布奇诺  ·  Unity ...·  2 年前    · 
public ref class MethodInfo abstract : System::Reflection::MethodBase
public ref class MethodInfo abstract : System::Reflection::MethodBase, System::Runtime::InteropServices::_MethodInfo
public abstract class MethodInfo : System.Reflection.MethodBase
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Serializable]
public abstract class MethodInfo : System.Reflection.MethodBase, System.Runtime.InteropServices._MethodInfo
[System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)]
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class MethodInfo : System.Reflection.MethodBase, System.Runtime.InteropServices._MethodInfo
type MethodInfo = class
    inherit MethodBase
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Serializable>]
type MethodInfo = class
    inherit MethodBase
    interface _MethodInfo
[<System.Runtime.InteropServices.ClassInterface(System.Runtime.InteropServices.ClassInterfaceType.None)>]
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type MethodInfo = class
    inherit MethodBase
    interface _MethodInfo
Public MustInherit Class MethodInfo
Inherits MethodBase
Public MustInherit Class MethodInfo
Inherits MethodBase
Implements _MethodInfo
MethodInfo

MethodInfo 表示类型的方法。 可以使用 MethodInfo 对象获取有关对象表示的方法的信息并调用方法。 例如:

  • 可以通过检索 、 IsFamilyOrAssembly IsPrivate IsPublic 属性的值来确定方法的 IsFamilyAndAssembly 可见性。

  • 可以通过检索 属性的值 Attributes 或调用 方法来发现应用于 方法的属性 GetCustomAttributes

  • 通过检索 和 ContainsGenericParameters 属性的值 IsGenericMethod ,可以确定该方法是泛型方法、开放式构造泛型方法还是封闭的构造泛型方法。

  • 可以从 方法以及 、 ReturnType ReturnTypeCustomAttributes 属性获取有关方法的参数和 ReturnParameter 返回类型 GetParameters 的信息。

  • 可以通过调用 Invoke 方法在类实例上执行方法。

  • 可以通过调用 方法, MethodInfo 从表示泛型方法定义的泛型方法实例化表示构造泛型方法的对象 MakeGenericMethod

    可以通过调用 Type.GetMethods 或 方法,或通过调用 MethodInfo.MakeGenericMethod 表示泛型方法定义的 对象的 方法 MethodInfo 来实例化 MethodInfo Type.GetMethod 实例。

    有关特定于泛型方法的术语的固定条件列表,请参阅 IsGenericMethod 属性。 有关泛型反射中使用的其他术语的固定条件列表,请参阅 IsGenericType 属性。

    实施者说明

    MethodInfo 继承时,必须重写 GetBaseDefinition() 、、 ReturnType ReturnTypeCustomAttributes GetParameters() GetMethodImplementationFlags() MethodHandle Attributes Invoke(Object, BindingFlags, Binder, Object[], CultureInfo) 、、 MemberType Name ReflectedType GetCustomAttributes(Boolean) DeclaringType 、、 GetCustomAttributes(Type, Boolean) 和 。 IsDefined(Type, Boolean)

  •