Freigeben über


PropertyDescriptorCollection.Find-Methode

Gibt die PropertyDescriptor-Klasse mit dem angegebenen Namen zurück. Mithilfe eines booleschen Werts wird angegeben, ob die Groß- und Kleinschreibung unberücksichtigt bleibt.

Namespace: System.ComponentModel
Assembly: System (in system.dll)

Syntax

'Declaration
Public Overridable Function Find ( _
    name As String, _
    ignoreCase As Boolean _
) As PropertyDescriptor
'Usage
Dim instance As PropertyDescriptorCollection
Dim name As String
Dim ignoreCase As Boolean
Dim returnValue As PropertyDescriptor

returnValue = instance.Find(name, ignoreCase)
public virtual PropertyDescriptor Find (
    string name,
    bool ignoreCase
)
public:
virtual PropertyDescriptor^ Find (
    String^ name, 
    bool ignoreCase
)
public PropertyDescriptor Find (
    String name, 
    boolean ignoreCase
)
public function Find (
    name : String, 
    ignoreCase : boolean
) : PropertyDescriptor

Parameter

  • name
    Der Name der PropertyDescriptor-Klasse, die aus der Auflistung zurückgegeben werden soll.
  • ignoreCase
    true, wenn die Groß- und Kleinschreibung des Eigenschaftennamens nicht berücksichtigt werden soll, andernfalls false.

Rückgabewert

Eine PropertyDescriptor-Klasse mit dem angegebenen Namen oder NULL (Nothing in Visual Basic), wenn die Eigenschaft nicht vorhanden ist.

Beispiel

Im folgenden Codebeispiel wird eine bestimmte PropertyDescriptor-Klasse gesucht. Der Typ der Komponente für diese PropertyDescriptor-Klasse wird in einem Textfeld ausgegeben. Dafür ist es erforderlich, dass button1 und textBox1 in einem Formular instanziiert wurden.

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
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;
}
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;
   }
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.set_Text(myProperty.get_DisplayName() + '\n' 
        + myProperty.get_Description());
} //FindProperty

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

.NET Compact Framework

Unterstützt in: 2.0, 1.0

Siehe auch

Referenz

PropertyDescriptorCollection-Klasse
PropertyDescriptorCollection-Member
System.ComponentModel-Namespace
PropertyDescriptor-Klasse
TypeDescriptor