TypeConverter.GetProperties 方法

定義

傳回由值參數所指定的陣列型別的屬性集合。Returns a collection of properties for the type of array specified by the value parameter.

多載

GetProperties(Object)

傳回由值參數所指定的陣列型別的屬性集合。Returns a collection of properties for the type of array specified by the value parameter.

GetProperties(ITypeDescriptorContext, Object)

會使用指定的內容,傳回由值參數所指定之陣列型別的屬性集合。Returns a collection of properties for the type of array specified by the value parameter, using the specified context.

GetProperties(ITypeDescriptorContext, Object, Attribute[])

使用指定的內容和屬性 (attribute),傳回由該值參數所指定之陣列類型的屬性 (property) 集合。Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes.

GetProperties(Object)

傳回由值參數所指定的陣列型別的屬性集合。Returns a collection of properties for the type of array specified by the value parameter.

public:
 System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(System::Object ^ value);
public System.ComponentModel.PropertyDescriptorCollection GetProperties (object value);
member this.GetProperties : obj -> System.ComponentModel.PropertyDescriptorCollection
Public Function GetProperties (value As Object) As PropertyDescriptorCollection

參數

value
Object

Object,指定要取得屬性之陣列的型別。An Object that specifies the type of array for which to get properties.

傳回

具有為這個資料類型所公開之屬性的 PropertyDescriptorCollection,或者,如果沒有屬性則為 nullA PropertyDescriptorCollection with the properties that are exposed for this data type, or null if there are no properties.

備註

在這個類別中實作時,這個方法永遠傳回 nullAs implemented in this class, this method always returns null.

根據預設,型別不會傳回屬性。By default, a type does not return properties. 這個方法的輕鬆執行可以針對正確的資料類型呼叫 GetPropertiesAn easy implementation of this method can call GetProperties for the correct data type.

GetProperties(ITypeDescriptorContext, Object)

會使用指定的內容,傳回由值參數所指定之陣列型別的屬性集合。Returns a collection of properties for the type of array specified by the value parameter, using the specified context.

public:
 System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(System::ComponentModel::ITypeDescriptorContext ^ context, System::Object ^ value);
public System.ComponentModel.PropertyDescriptorCollection GetProperties (System.ComponentModel.ITypeDescriptorContext context, object value);
member this.GetProperties : System.ComponentModel.ITypeDescriptorContext * obj -> System.ComponentModel.PropertyDescriptorCollection
Public Function GetProperties (context As ITypeDescriptorContext, value As Object) As PropertyDescriptorCollection

參數

context
ITypeDescriptorContext

提供格式內容的 ITypeDescriptorContextAn ITypeDescriptorContext that provides a format context.

value
Object

Object,指定要取得屬性之陣列的型別。An Object that specifies the type of array for which to get properties.

傳回

具有為這個資料類型所公開之屬性的 PropertyDescriptorCollection,或者,如果沒有屬性則為 nullA PropertyDescriptorCollection with the properties that are exposed for this data type, or null if there are no properties.

備註

context 參數可以用於擷取環境的其他資訊,而這個轉換子就是從該環境叫用的。Use the context parameter to extract additional information about the environment from which this converter is invoked. 這個參數可以 null,因此請一律檢查它。This parameter can be null, so always check it. 甚至,內容物件上的屬性可能會傳回 nullAlso, properties on the context object can return null.

在這個類別中實作時,這個方法永遠傳回 nullAs implemented in this class, this method always returns null.

根據預設,型別不會傳回屬性。By default, a type does not return properties. 這個方法的輕鬆執行可以針對正確的資料類型呼叫 GetPropertiesAn easy implementation of this method can call GetProperties for the correct data type.

另請參閱

GetProperties(ITypeDescriptorContext, Object, Attribute[])

使用指定的內容和屬性 (attribute),傳回由該值參數所指定之陣列類型的屬性 (property) 集合。Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes.

public:
 virtual System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(System::ComponentModel::ITypeDescriptorContext ^ context, System::Object ^ value, cli::array <Attribute ^> ^ attributes);
public virtual System.ComponentModel.PropertyDescriptorCollection GetProperties (System.ComponentModel.ITypeDescriptorContext context, object value, Attribute[] attributes);
abstract member GetProperties : System.ComponentModel.ITypeDescriptorContext * obj * Attribute[] -> System.ComponentModel.PropertyDescriptorCollection
override this.GetProperties : System.ComponentModel.ITypeDescriptorContext * obj * Attribute[] -> System.ComponentModel.PropertyDescriptorCollection
Public Overridable Function GetProperties (context As ITypeDescriptorContext, value As Object, attributes As Attribute()) As PropertyDescriptorCollection

參數

context
ITypeDescriptorContext

提供格式內容的 ITypeDescriptorContextAn ITypeDescriptorContext that provides a format context.

value
Object

Object,指定要取得屬性之陣列的型別。An Object that specifies the type of array for which to get properties.

attributes
Attribute[]

Attribute 類型陣列,可當做篩選條件使用。An array of type Attribute that is used as a filter.

傳回

具有為這個資料類型所公開之屬性的 PropertyDescriptorCollection,或者,如果沒有屬性則為 nullA PropertyDescriptorCollection with the properties that are exposed for this data type, or null if there are no properties.

備註

在這個類別中實作時,這個方法永遠傳回 nullAs implemented in this class, this method always returns null.

給繼承者的注意事項

如果您想要轉換的類型支援屬性,請覆寫這個方法。Override this method if the type you want to convert supports properties.

context 參數可以用於擷取環境的其他資訊,而這個轉換子就是從該環境叫用的。Use the context parameter to extract additional information about the environment from which this converter is invoked. 這個參數可以 null,因此請一律檢查它。This parameter can be null, so always check it. 甚至,內容物件上的屬性可能會傳回 nullAlso, properties on the context object can return null.

屬性陣列是用來篩選陣列。The attributes array is used to filter the array. 屬性可以混合使用 TypeAttribute 物件。The attributes can have a mix of Type and Attribute objects. 篩選是由下列規則所定義:Filtering is defined by the following rules: -Type 會被視為萬用字元;它會比對其屬性集內具有 Type 的屬性。- A Type is treated as a wildcard; it matches a property that has the Type in its set of attributes.

-如果屬性沒有相同類別的 Attribute,則屬性不會包含在傳回的陣列中。- If a property does not have an Attribute of the same class, the property is not included in the returned array.

-如果屬性是 Attribute的實例,則屬性必須完全相符,否則不會包含在傳回的陣列中。- If the attribute is an instance of Attribute, the property must be an exact match or it is not included in the returned array.

-如果指定了 Attribute 實例,而且它是預設屬性,則即使屬性中沒有任何 Attribute 實例,它仍會包含在傳回的陣列中。- If an Attribute instance is specified and it is the default property, it is included in the returned array even if there is no instance of the Attribute in the property.

另請參閱

適用於