PropertyDescriptorCollection.Find(String, Boolean) Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Gibt den PropertyDescriptor mit dem angegebenen Namen angegebenen Namen zurück, wobei ein Boolescher Wert verwendet wird, um anzugeben, ob die Groß-/Kleinschreibung ignoriert werden soll.
public:
virtual System::ComponentModel::PropertyDescriptor ^ Find(System::String ^ name, bool ignoreCase);
public virtual System.ComponentModel.PropertyDescriptor? Find(string name, bool ignoreCase);
public virtual System.ComponentModel.PropertyDescriptor Find(string name, bool ignoreCase);
abstract member Find : string * bool -> System.ComponentModel.PropertyDescriptor
override this.Find : string * bool -> System.ComponentModel.PropertyDescriptor
Public Overridable Function Find (name As String, ignoreCase As Boolean) As PropertyDescriptor
Parameter
- name
- String
Der Name des zurückzugebenden Werts PropertyDescriptor aus der Auflistung.
- ignoreCase
- Boolean
truewenn Sie die Groß-/Kleinschreibung des Eigenschaftennamens ignorieren möchten; andernfalls . false
Gibt zurück
A PropertyDescriptor mit dem angegebenen Namen oder null wenn die Eigenschaft nicht vorhanden ist.
Beispiele
Im folgenden Codebeispiel wird ein bestimmter PropertyDescriptorCode gefunden. Er druckt den Typ der Komponente dafür PropertyDescriptor in einem Textfeld. Dies erfordert button1 und textBox1 wurde auf einem Formular instanziiert.
private:
void FindProperty()
{
// Creates a new collection and assign it the properties for button1.
PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 );
// Sets a PropertyDescriptor to the specific property.
PropertyDescriptor^ myProperty = properties->Find( "Opacity", false );
// Prints the property and the property description.
textBox1->Text = myProperty->DisplayName + "\n" + myProperty->Description;
}
void FindProperty()
{
// Creates a new collection and assign it the properties for button1.
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1);
// Sets a PropertyDescriptor to the specific property.
PropertyDescriptor myProperty = properties.Find("Opacity", false);
// Prints the property and the property description.
textBox1.Text = myProperty.DisplayName + '\n' + myProperty.Description;
}
Private Sub FindProperty()
' Creates a new collection and assign it the properties for button1.
Dim properties As PropertyDescriptorCollection = _
TypeDescriptor.GetProperties(button1)
' Sets a PropertyDescriptor to the specific property.
Dim myProperty As PropertyDescriptor = properties.Find("Opacity", False)
' Prints the property and the property description.
textBox1.Text = myProperty.DisplayName & _
Microsoft.VisualBasic.ControlChars.Cr & myProperty.Description
End Sub