Share via


PropertyDescriptorCollection.Find(String, Boolean) Yöntem

Tanım

PropertyDescriptor Büyük/küçük harf yoksayılıp yoksayılmayacağını belirtmek için Boole değeri kullanarak belirtilen ada sahip değerini döndürür.

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

Parametreler

name
String

Koleksiyondan döndürülecek öğesinin PropertyDescriptor adı.

ignoreCase
Boolean

true özellik adının büyük/küçük harf durumunu yoksaymak istiyorsanız; aksi takdirde , false.

Döndürülenler

PropertyDescriptor Belirtilen ada sahip bir veya null özelliği yoksa.

Örnekler

Aşağıdaki kod örneği belirli PropertyDescriptorbir bulur. Bunun için PropertyDescriptor bileşen türünü bir metin kutusuna yazdırır. Bunun için bir textBox1 formda örnek oluşturulması gerekirbutton1.

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 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

Şunlara uygulanır

Ayrıca bkz.