ExpandableObjectConverter.GetProperties Metod

Definition

Hämtar en samling egenskaper för den typ av objekt som anges av värdeparametern.

public:
 override System::ComponentModel::PropertyDescriptorCollection ^ GetProperties(System::ComponentModel::ITypeDescriptorContext ^ context, System::Object ^ value, cli::array <Attribute ^> ^ attributes);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of value cannot be statically discovered. The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")]
public override System.ComponentModel.PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext? context, object value, Attribute[]? attributes);
public override System.ComponentModel.PropertyDescriptorCollection GetProperties(System.ComponentModel.ITypeDescriptorContext context, object value, Attribute[] attributes);
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of value cannot be statically discovered. The public parameterless constructor or the 'Default' static field may be trimmed from the Attribute's Type.")>]
override this.GetProperties : System.ComponentModel.ITypeDescriptorContext * obj * Attribute[] -> System.ComponentModel.PropertyDescriptorCollection
override this.GetProperties : System.ComponentModel.ITypeDescriptorContext * obj * Attribute[] -> System.ComponentModel.PropertyDescriptorCollection
Public Overrides Function GetProperties (context As ITypeDescriptorContext, value As Object, attributes As Attribute()) As PropertyDescriptorCollection

Parametrar

context
ITypeDescriptorContext

En ITypeDescriptorContext som ger en formatkontext.

value
Object

En Object som anger vilken typ av objekt som egenskaperna ska hämtas för.

attributes
Attribute[]

En matris av typen Attribute som ska användas som ett filter.

Returer

A PropertyDescriptorCollection med de egenskaper som exponeras för komponenten eller null om det inte finns några egenskaper.

Attribut

Kommentarer

Parametern context kan användas för att extrahera ytterligare information om miljön som konverteraren anropas från. Detta kan vara null, så kontrollera alltid. Dessutom kan egenskaper för kontextobjektet returnera null.

Matrisen attributes används för att filtrera matrisen. Kan attributes ha en blandning av Type och Attribute objekt. Filtrering definieras av följande regler:

  • Ett Type objekt behandlas som ett jokertecken. Det matchar alla egenskaper som har Type i sin uppsättning attribut.

  • Om en egenskap inte har en Attribute av samma klass inkluderas inte egenskapen i den returnerade matrisen.

  • Om attributet är en instans av Attributemåste egenskapen vara en exakt matchning, annars inkluderas den inte i den returnerade matrisen.

  • Om en Attribute instans anges och det är standardegenskapen inkluderas den i den returnerade matrisen även om det inte finns någon instans av Attribute egenskapen i egenskapen.

Gäller för

Se även