MemberDescriptor 类

定义

表示一个类成员,例如某个属性或事件。Represents a class member, such as a property or event. 这是一个抽象基类。This is an abstract base class.

public ref class MemberDescriptor abstract
public abstract class MemberDescriptor
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class MemberDescriptor
type MemberDescriptor = class
[<System.Runtime.InteropServices.ComVisible(true)>]
type MemberDescriptor = class
Public MustInherit Class MemberDescriptor
继承
MemberDescriptor
派生
属性

示例

由于此类的大部分使用将落在继承的类和上 EventDescriptor PropertyDescriptor ,因此请参阅这些类中的示例。Since most of the usage of this class will fall on the inherited classes EventDescriptor and PropertyDescriptor, refer to the examples in these classes.

注解

MemberDescriptorEventDescriptor 和类的基类 PropertyDescriptorMemberDescriptor is the base class for the EventDescriptor and the PropertyDescriptor classes. EventDescriptor类提供事件的说明, PropertyDescriptor 类提供对属性的说明。The EventDescriptor class provides a description of an event, and the PropertyDescriptor class provides a description of a property.

此类定义用于访问其存储属性的属性和方法。This class defines properties and methods to access its stored attributes. Attributes属性获取属性的集合。The Attributes property gets the collection of attributes. CategoryIsBrowsableDescriptionDesignTimeOnly 属性检索这些特定属性的值。The Category, IsBrowsable, Description, and DesignTimeOnly properties retrieve the values of those specific attributes. NameDisplayName 属性提供成员的名称。The Name and DisplayName properties provide the name of the member.

MemberDescriptor还定义了一个 Equals 方法来将其与 MemberDescriptor 另一个进行比较。The MemberDescriptor also defines an Equals method to compare this MemberDescriptor to another.

备注

通常,从 EventDescriptorPropertyDescriptor 类(而不是从此类)继承。Typically, you inherit from the EventDescriptor and PropertyDescriptor classes, and not from this class.

构造函数

MemberDescriptor(MemberDescriptor)

使用指定的 MemberDescriptor 初始化 MemberDescriptor 类的新实例。Initializes a new instance of the MemberDescriptor class with the specified MemberDescriptor.

MemberDescriptor(MemberDescriptor, Attribute[])

用指定的 MemberDescriptor 中的名称以及同时出现在旧 MemberDescriptorMemberDescriptor 数组中的特性初始化 Attribute 类的新实例。Initializes a new instance of the MemberDescriptor class with the name in the specified MemberDescriptor and the attributes in both the old MemberDescriptor and the Attribute array.

MemberDescriptor(String)

用指定的成员名称初始化 MemberDescriptor 类的新实例。Initializes a new instance of the MemberDescriptor class with the specified name of the member.

MemberDescriptor(String, Attribute[])

用指定的成员名称和特性数组初始化 MemberDescriptor 类的新实例。Initializes a new instance of the MemberDescriptor class with the specified name of the member and an array of attributes.

属性

AttributeArray

获取或设置属性的数组。Gets or sets an array of attributes.

Attributes

获取该成员的特性集合。Gets the collection of attributes for this member.

Category

获取该成员所属的类别的名称,如 CategoryAttribute 中所指定的。Gets the name of the category to which the member belongs, as specified in the CategoryAttribute.

Description

获取成员的说明,如 DescriptionAttribute 中所指定的。Gets the description of the member, as specified in the DescriptionAttribute.

DesignTimeOnly

获取是否只能在设计时设置该成员,如 DesignOnlyAttribute 中所指定的。Gets whether this member should be set only at design time, as specified in the DesignOnlyAttribute.

DisplayName

获取可以显示在窗口(如“属性”窗口)中的名称。Gets the name that can be displayed in a window, such as a Properties window.

IsBrowsable

获取一个指示该成员是否可浏览的值,如 BrowsableAttribute 中所指定的。Gets a value indicating whether the member is browsable, as specified in the BrowsableAttribute.

Name

获取此成员的名称。Gets the name of the member.

NameHashCode

获取此成员名称的哈希代码,如 GetHashCode() 中所指定的。Gets the hash code for the name of the member, as specified in GetHashCode().

方法

CreateAttributeCollection()

使用传递到构造函数的特性数组创建特性的集合。Creates a collection of attributes using the array of attributes passed to the constructor.

Equals(Object)

将该实例与给定的对象进行比较以了解它们是否等效。Compares this instance to the given object to see if they are equivalent.

FillAttributes(IList)

当在派生类中被重写时,将继承类的特性添加到父类中指定的特性列表。When overridden in a derived class, adds the attributes of the inheriting class to the specified list of attributes in the parent class.

FindMethod(Type, String, Type[], Type)

通过反射查找给定的方法,只搜索公共方法。Finds the given method through reflection, searching only for public methods.

FindMethod(Type, String, Type[], Type, Boolean)

带一个仅搜索公共方法的选项,通过反射查找给定的方法。Finds the given method through reflection, with an option to search only public methods.

GetHashCode()

返回此实例的哈希代码。Returns the hash code for this instance.

GetInvocationTarget(Type, Object)

检索应在成员调用期间使用的对象。Retrieves the object that should be used during invocation of members.

GetInvokee(Type, Object)
已过时。
已过时。
已过时。

获取在其上调用方法的组件。Gets the component on which to invoke a method.

GetSite(Object)

获取给定组件的组件位置。Gets a component site for the given component.

GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

适用于

另请参阅