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
Public MustInherit Class MemberDescriptor
繼承
MemberDescriptor
衍生
屬性

範例

因為此類別的大部分用法都會落在繼承的類別 EventDescriptorPropertyDescriptor上,請參閱這些類別中的範例。Since most of the usage of this class will fall on the inherited classes EventDescriptor and PropertyDescriptor, refer to the examples in these classes.

備註

MemberDescriptorEventDescriptorPropertyDescriptor 類別的基類。MemberDescriptor 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. [Category]、[IsBrowsable]、[Description] 和 [DesignTimeOnly] 屬性會抓取這些特定屬性的值。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)

透過反映搜尋指定的方法,只搜尋公用 (Public) 方法。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)

取得要在其上叫用 (Invoke) 方法的元件。Gets the component on which to invoke a method.

GetSite(Object)

取得指定元件的元件站台 (Component Site)。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)

適用於

另請參閱