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

构造函数


名称说明
 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类MethodBase()

初始化 MethodBase 类的新实例。

属性


名称说明
 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_02Attributes

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03CallingConvention

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03ContainsGenericParameters

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03CustomAttributes

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03DeclaringType

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsAbstract

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsAssembly

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsConstructor

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsFamily

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsFamilyAndAssembly

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsFamilyOrAssembly

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsFinal

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsGenericMethod

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsGenericMethodDefinition

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsHideBySig

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsPrivate

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsPublic

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsSecurityCritical

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsSecuritySafeCritical

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsSecurityTransparent

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsSpecialName

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsStatic

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03IsVirtual

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03MemberType

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03MetadataToken

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03MethodHandle

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03MethodImplementationFlags

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03Module

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03Name

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_03ReflectedType

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


方法


名称说明
 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_32Equals(Object)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_33Finalize()

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_35GetCurrentMethod()

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetCustomAttributes(Boolean)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetCustomAttributes(Type,Boolean)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetCustomAttributesData()

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetGenericArguments()

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetHashCode()

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetMethodBody()

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_43GetMethodFromHandle(RuntimeMethodHandle)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_43GetMethodFromHandle(RuntimeMethodHandle,RuntimeTypeHandle)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetMethodImplementationFlags()

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetParameters()

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetType()

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34Invoke(Object,BindingFlags,Binder,Object[],CultureInfo)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34Invoke(Object,Object[])

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34IsDefined(Type,Boolean)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_33MemberwiseClone()

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34ToString()

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

运算符


名称说明
 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_54 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_43Equality(MethodBase,MethodBase)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_56 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_43Inequality(MethodBase,MethodBase)

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

显式接口实现


名称说明
 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_58 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_59_MemberInfo.GetIDsOfNames(Guid,IntPtr,UInt32,UInt32,IntPtr)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_61_MemberInfo.GetType()

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_61_MemberInfo.GetTypeInfo(UInt32,UInt32,IntPtr)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_61_MemberInfo.GetTypeInfoCount(UInt32)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_61_MemberInfo.Invoke(UInt32,Guid,UInt32,Int16,IntPtr,IntPtr,IntPtr,IntPtr)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_61_MethodBase.GetIDsOfNames(Guid,IntPtr,UInt32,UInt32,IntPtr)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_61_MethodBase.GetType()

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_61_MethodBase.GetTypeInfo(UInt32,UInt32,IntPtr)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_61_MethodBase.GetTypeInfoCount(UInt32)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_61_MethodBase.Invoke(UInt32,Guid,UInt32,Int16,IntPtr,IntPtr,IntPtr,IntPtr)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_79_MethodBase.IsAbstract

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_81_MethodBase.IsAssembly

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_81_MethodBase.IsConstructor

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_81_MethodBase.IsFamily

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_81_MethodBase.IsFamilyAndAssembly

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_81_MethodBase.IsFamilyOrAssembly

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_81_MethodBase.IsFinal

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_81_MethodBase.IsHideBySig

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_81_MethodBase.IsPrivate

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_81_MethodBase.IsPublic

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_81_MethodBase.IsSpecialName

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_81_MethodBase.IsStatic

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_60 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_81_MethodBase.IsVirtual

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

扩展方法


名称说明
 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetCustomAttribute(Type)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetCustomAttribute(Type,Boolean)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetCustomAttribute<T>()

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetCustomAttribute<T>(Boolean)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetCustomAttributes()

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetCustomAttributes(Type)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34GetCustomAttributes<T>(Boolean)

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

 C#学习常用命名空间【1000】---System.Reflection 之MethodBase(方法库类) _MethodBase类_34IsDefined(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