MethodBase 类

命名空间:                   System.Reflection
程序集:         mscorlib(位于 mscorlib.dll)

继承层次结构

System.Object
System.Reflection.MemberInfo
System.Reflection.MethodBase
System.Reflection.ConstructorInfo
System.Reflection.MethodInfo

语法:
[SerializableAttribute]
[ClassInterfaceAttribute(ClassInterfaceType.None)]
[ComVisibleAttribute(true)]
[PermissionSetAttribute(SecurityAction.InheritanceDemand, Name = "FullTrust")]
public abstract class MethodBase : MemberInfo, _MethodBase

构造函数


名称说明
System_CAPS_protmethodMethodBase()

初始化 MethodBase 类的新实例。

属性


名称说明
System_CAPS_pubpropertyAttributes

获取与此方法关联的属性。

System_CAPS_pubpropertyCallingConvention

获取一个值,该值指示此方法的调用约定

System_CAPS_pubpropertyContainsGenericParameters

获取一个值,该值指示泛型方法是否包含未分配的泛型类型参数。

System_CAPS_pubpropertyCustomAttributes

获取包含此成员的自定义特性的集合。(继承自 MemberInfo。)

System_CAPS_pubpropertyDeclaringType

获取声明此成员的类。(继承自 MemberInfo。)

System_CAPS_pubpropertyIsAbstract

获取一个值,该值指示该方法为抽象。

System_CAPS_pubpropertyIsAssembly

获取一个值,该值指示是否由描述此方法或构造函数的潜在可见 MethodAttributes.Assembly; 也就是说,方法或构造函数显示最多为同一程序集中的其他类型也看不到派生类型的程序集之外。

System_CAPS_pubpropertyIsConstructor

获取一个值,该值指示方法是否一个构造函数。

System_CAPS_pubpropertyIsFamily

获取一个值,该值指示是否由描述此方法或构造函数的可见性 MethodAttributes.Family; 即方法或构造函数是仅在其类以及派生的类中可见。

System_CAPS_pubpropertyIsFamilyAndAssembly

获取一个值,该值指示是否由描述此方法或构造函数的可见性 MethodAttributes.FamANDAssem; 也就是说,方法或构造函数可由派生类中,但仅限它们是否位于同一程序集中。

System_CAPS_pubpropertyIsFamilyOrAssembly

获取一个值,该值指示是否由描述此方法或构造函数的潜在可见 MethodAttributes.FamORAssem; 也就是说,该方法或构造函数可以调用由派生类无论他们身在何处,并由同一程序集中的类。

System_CAPS_pubpropertyIsFinal

获取一个值,该值指示此方法是否 final

System_CAPS_pubpropertyIsGenericMethod

获取一个值,该值指示该方法泛型。

System_CAPS_pubpropertyIsGenericMethodDefinition

获取一个值,该值指示方法是否泛型方法定义。

System_CAPS_pubpropertyIsHideBySig

获取一个值,该值指示是否在派生类中隐藏只有完全相同的签名的相同种类的成员。

System_CAPS_pubpropertyIsPrivate

获取一个值,该值指示此成员私有。

System_CAPS_pubpropertyIsPublic

获取一个值,该值指示这是否为公共方法。

System_CAPS_pubpropertyIsSecurityCritical

获取一个值,该值指示当前方法或构造函数是安全关键或安全可靠关键在当前信任级别,因此可以执行关键操作。

System_CAPS_pubpropertyIsSecuritySafeCritical

获取一个值,该值指示是否当前方法或构造函数是安全可靠关键在当前信任级别;也就是说,它是否可以执行关键操作并可以由透明代码访问。

System_CAPS_pubpropertyIsSecurityTransparent

获取一个值,该值指示是否当前方法或构造函数是在透明当前信任级别,并因此不能执行一些关键操作。

System_CAPS_pubpropertyIsSpecialName

获取一个值,该值指示此方法是否具有特殊名称。

System_CAPS_pubpropertyIsStatic

获取一个值,该值指示方法是否 static

System_CAPS_pubpropertyIsVirtual

获取一个值,该值指示方法是否 virtual

System_CAPS_pubpropertyMemberType

当在派生类中重写时获取 MemberTypes 值,该值指示该成员的类型 — 方法、 构造函数、 事件中,依次类推。(继承自 MemberInfo。)

System_CAPS_pubpropertyMetadataToken

获取一个值,标识元数据中的元素。(继承自 MemberInfo。)

System_CAPS_pubpropertyMethodHandle

获取一种方法的内部元数据表示的句柄。

System_CAPS_pubpropertyMethodImplementationFlags

获取 MethodImplAttributes 标志,用于指定某个方法实现的属性。

System_CAPS_pubpropertyModule

获取在其中声明该成员的类型表示由当前类型的模块 MemberInfo 定义。(继承自 MemberInfo。)

System_CAPS_pubpropertyName

获取当前成员的名称。(继承自 MemberInfo。)

System_CAPS_pubpropertyReflectedType

获取用于获取此实例的类对象 MemberInfo(继承自 MemberInfo。)


方法


名称说明
System_CAPS_pubmethodEquals(Object)

返回一个值,该值指示此实例是否与指定的对象相等。(覆盖 MemberInfo.Equals(Object)。)

System_CAPS_protmethodFinalize()

在垃圾回收将某一对象回收前允许该对象尝试释放资源并执行其他清理操作。(继承自 Object。)

System_CAPS_pubmethodSystem_CAPS_staticGetCurrentMethod()

返回 MethodBase 对象,表示当前执行的方法。

System_CAPS_pubmethodGetCustomAttributes(Boolean)

当在派生类中重写,则返回的所有自定义特性应用于此成员的数组。(继承自 MemberInfo。)

System_CAPS_pubmethodGetCustomAttributes(Type,Boolean)

当在派生类中重写时返回的自定义特性应用于此成员和由标识数组 Type(继承自 MemberInfo。)

System_CAPS_pubmethodGetCustomAttributesData()

返回的列表 CustomAttributeData 对象表示有关已应用于目标成员的特性的数据。(继承自 MemberInfo。)

System_CAPS_pubmethodGetGenericArguments()

返回 Type 对象的数组,这些对象表示泛型方法的类型实参或泛型方法定义的类型形参。

System_CAPS_pubmethodGetHashCode()

返回此实例的哈希代码。(覆盖 MemberInfo.GetHashCode()。)

System_CAPS_pubmethodGetMethodBody()

当在派生类中重写时获取 MethodBody 对象,它提供访问当前方法的 MSIL 流、 本地变量和异常。

System_CAPS_pubmethodSystem_CAPS_staticGetMethodFromHandle(RuntimeMethodHandle)

通过使用该方法的内部元数据表示形式 (句柄) 获取方法的信息。

System_CAPS_pubmethodSystem_CAPS_staticGetMethodFromHandle(RuntimeMethodHandle,RuntimeTypeHandle)

获取 MethodBase 构造函数或由指定的句柄,用于指定泛型类型的方法的对象。

System_CAPS_pubmethodGetMethodImplementationFlags()

当在派生类中重写返回 MethodImplAttributes 标志。

System_CAPS_pubmethodGetParameters()

当在派生类中重写,获取指定的方法或构造函数的参数。

System_CAPS_pubmethodGetType()

获取当前实例的 Type(继承自 Object。)

System_CAPS_pubmethodInvoke(Object,BindingFlags,Binder,Object[],CultureInfo)

当在派生类中重写时,将调用的反射的方法或使用给定的参数的构造函数。

System_CAPS_pubmethodInvoke(Object,Object[])

调用方法或构造函数使用指定的参数与当前实例表示的。

System_CAPS_pubmethodIsDefined(Type,Boolean)

当在派生类中重写,该值指示是否指定类型的字段或其派生类型的一个或多个特性应用于此成员。(继承自 MemberInfo。)

System_CAPS_protmethodMemberwiseClone()

创建当前 Object 的浅表副本。(继承自 Object。)

System_CAPS_pubmethodToString()

返回表示当前对象的字符串。(继承自 Object。)

运算符


名称说明
System_CAPS_puboperatorSystem_CAPS_staticEquality(MethodBase,MethodBase)

指示两个 MethodBase 对象是否相等。

System_CAPS_puboperatorSystem_CAPS_staticInequality(MethodBase,MethodBase)

指示两个 MethodBase 对象是否不相等。

显式接口实现


名称说明
System_CAPS_pubinterfaceSystem_CAPS_privmethod_MemberInfo.GetIDsOfNames(Guid,IntPtr,UInt32,UInt32,IntPtr)

将一组名称映射为对应的一组调度标识符。(继承自 MemberInfo。)

System_CAPS_pubinterfaceSystem_CAPS_privmethod_MemberInfo.GetType()

获取 Type 对象,表示 MemberInfo 类。(继承自 MemberInfo。)

System_CAPS_pubinterfaceSystem_CAPS_privmethod_MemberInfo.GetTypeInfo(UInt32,UInt32,IntPtr)

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。(继承自 MemberInfo。)

System_CAPS_pubinterfaceSystem_CAPS_privmethod_MemberInfo.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。(继承自 MemberInfo。)

System_CAPS_pubinterfaceSystem_CAPS_privmethod_MemberInfo.Invoke(UInt32,Guid,UInt32,Int16,IntPtr,IntPtr,IntPtr,IntPtr)

提供对某一对象公开的属性和方法的访问。(继承自 MemberInfo。)

System_CAPS_pubinterfaceSystem_CAPS_privmethod_MethodBase.GetIDsOfNames(Guid,IntPtr,UInt32,UInt32,IntPtr)

将一组名称映射为对应的一组调度标识符。

System_CAPS_pubinterfaceSystem_CAPS_privmethod_MethodBase.GetType()

有关此成员的说明,请参阅 _MethodBase.GetType

System_CAPS_pubinterfaceSystem_CAPS_privmethod_MethodBase.GetTypeInfo(UInt32,UInt32,IntPtr)

检索对象的类型信息,然后可以使用该信息获取接口的类型信息。

System_CAPS_pubinterfaceSystem_CAPS_privmethod_MethodBase.GetTypeInfoCount(UInt32)

检索对象提供的类型信息接口的数量(0 或 1)。

System_CAPS_pubinterfaceSystem_CAPS_privmethod_MethodBase.Invoke(UInt32,Guid,UInt32,Int16,IntPtr,IntPtr,IntPtr,IntPtr)

提供对某一对象公开的属性和方法的访问。

System_CAPS_pubinterfaceSystem_CAPS_privproperty_MethodBase.IsAbstract

有关此成员的说明,请参阅 _MethodBase.IsAbstract

System_CAPS_pubinterfaceSystem_CAPS_privproperty_MethodBase.IsAssembly

有关此成员的说明,请参阅 _MethodBase.IsAssembly

System_CAPS_pubinterfaceSystem_CAPS_privproperty_MethodBase.IsConstructor

有关此成员的说明,请参阅 _MethodBase.IsConstructor

System_CAPS_pubinterfaceSystem_CAPS_privproperty_MethodBase.IsFamily

有关此成员的说明,请参阅 _MethodBase.IsFamily

System_CAPS_pubinterfaceSystem_CAPS_privproperty_MethodBase.IsFamilyAndAssembly

有关此成员的说明,请参阅 _MethodBase.IsFamilyAndAssembly

System_CAPS_pubinterfaceSystem_CAPS_privproperty_MethodBase.IsFamilyOrAssembly

有关此成员的说明,请参阅 _MethodBase.IsFamilyOrAssembly

System_CAPS_pubinterfaceSystem_CAPS_privproperty_MethodBase.IsFinal

有关此成员的说明,请参阅 _MethodBase.IsFinal

System_CAPS_pubinterfaceSystem_CAPS_privproperty_MethodBase.IsHideBySig

有关此成员的说明,请参阅 _MethodBase.IsHideBySig

System_CAPS_pubinterfaceSystem_CAPS_privproperty_MethodBase.IsPrivate

有关此成员的说明,请参阅 _MethodBase.IsPrivate

System_CAPS_pubinterfaceSystem_CAPS_privproperty_MethodBase.IsPublic

有关此成员的说明,请参阅 _MethodBase.IsPublic

System_CAPS_pubinterfaceSystem_CAPS_privproperty_MethodBase.IsSpecialName

有关此成员的说明,请参阅 _MethodBase.IsSpecialName

System_CAPS_pubinterfaceSystem_CAPS_privproperty_MethodBase.IsStatic

有关此成员的说明,请参阅 _MethodBase.IsStatic

System_CAPS_pubinterfaceSystem_CAPS_privproperty_MethodBase.IsVirtual

有关此成员的说明,请参阅 _MethodBase.IsVirtual

扩展方法


名称说明
System_CAPS_pubmethodGetCustomAttribute(Type)

已重载。检索指定类型的应用于指定的成员的自定义属性。(由 CustomAttributeExtensions 定义。)

System_CAPS_pubmethodGetCustomAttribute(Type,Boolean)

已重载。检索指定类型的应用于指定的成员,并根据需要检查该成员的祖先的自定义属性。(由 CustomAttributeExtensions 定义。)

System_CAPS_pubmethodGetCustomAttribute<T>()

已重载。检索指定类型的应用于指定的成员的自定义属性。(由 CustomAttributeExtensions 定义。)

System_CAPS_pubmethodGetCustomAttribute<T>(Boolean)

已重载。检索指定类型的应用于指定的成员,并根据需要检查该成员的祖先的自定义属性。(由 CustomAttributeExtensions 定义。)

System_CAPS_pubmethodGetCustomAttributes()

已重载。检索应用于指定的成员的自定义特性的集合。(由 CustomAttributeExtensions 定义。)

System_CAPS_pubmethodGetCustomAttributes(Type)

已重载。检索具有指定类型的自定义应用于指定的成员的特性的集合。(由 CustomAttributeExtensions 定义。)

System_CAPS_pubmethodGetCustomAttributes<T>(Boolean)

已重载。检索应用于指定成员的自定义特性的指定类型的集合,并根据需要检查该成员的祖先。(由 CustomAttributeExtensions 定义。)

System_CAPS_pubmethodIsDefined(Type)

已重载。指示是否为指定类型的自定义特性随即应用于指定的成员。(由 CustomAttributeExtensions 定义。)

备注

 MethodBase 是类的基类 MethodInfoConstructorInfo

继承函数说明:

继承自 MethodBase, ,必须重写以下成员︰ MethodBase.GetParameters, ,MethodBase.Invoke, ,MethodBase.GetMethodImplementationFlags, ,MethodBase.MethodHandle, ,MethodBase.Attributes, ,MemberInfo.Name, ,MemberInfo.DeclaringType, ,MemberInfo.MemberType, ,MemberInfo.ReflectedType, ,MemberInfo.GetCustomAttributes(Boolean), ,MemberInfo.GetCustomAttributes(Type,Boolean), ,和 MemberInfo.IsDefined

安全性

SecurityAction.InheritanceDemand

for full trust for inheritors. This class cannot be inherited by partially trusted code.


备注:转自https://msdn.microsoft.com/zh-cn/library/system.reflection.methodbase.aspx#mainBody