Share via


PropertyDescriptorCollection.Item[] Özellik

Tanım

Belirtilen PropertyDescriptordeğerini alır veya ayarlar.

Aşırı Yüklemeler

Item[Int32]

Belirtilen dizin numarasında değerini PropertyDescriptor alır veya ayarlar.

Item[String]

belirtilen adla öğesini PropertyDescriptor alır veya ayarlar.

Item[Int32]

Kaynak:
PropertyDescriptorCollection.cs
Kaynak:
PropertyDescriptorCollection.cs
Kaynak:
PropertyDescriptorCollection.cs

Belirtilen dizin numarasında değerini PropertyDescriptor alır veya ayarlar.

public:
 virtual property System::ComponentModel::PropertyDescriptor ^ default[int] { System::ComponentModel::PropertyDescriptor ^ get(int index); };
public virtual System.ComponentModel.PropertyDescriptor this[int index] { get; }
member this.Item(int) : System.ComponentModel.PropertyDescriptor
Default Public Overridable ReadOnly Property Item(index As Integer) As PropertyDescriptor

Parametreler

index
Int32

Alınacak veya ayarlanacağı sıfır tabanlı dizini PropertyDescriptor .

Özellik Değeri

PropertyDescriptor Belirtilen dizin numarasına sahip olan.

Özel durumlar

index parametresi için Item[Int32]geçerli bir dizin değil.

Örnekler

Aşağıdaki kod örneği, dizin numarası tarafından belirtilen adı PropertyDescriptor bir metin kutusuna yazdırmak için özelliğini kullanırItem[]. Dizin numarası sıfır tabanlı olduğundan, bu örnek ikinci PropertyDescriptoröğesinin adını yazdırır. Bir formda örneğinin oluşturulmasını gerektirir button1 .

void PrintIndexItem()
{
   
   // Creates a new collection and assigns it the properties for button1.
   PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 );
   
   // Prints the second property's name.
   textBox1->Text = properties[ 1 ]->ToString();
}
private void PrintIndexItem() {
    // Creates a new collection and assigns it the properties for button1.
    PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1);
 
    // Prints the second property's name.
    textBox1.Text = properties[1].ToString();
 }
Private Sub PrintIndexItem()
    ' Creates a new collection and assigns it the properties for button1.
    Dim properties As PropertyDescriptorCollection = TypeDescriptor.GetProperties(button1)
       
    ' Prints the second property's name.
    textBox1.Text = properties(1).ToString()
End Sub

Açıklamalar

Dizin numarası sıfır tabanlıdır. Bu nedenle, bu öğesine erişmek PropertyDescriptoriçin belirli PropertyDescriptor bir öğesinin sayısal konumundan 1 çıkarmanız gerekir. Örneğin, üçüncü PropertyDescriptordeğerini almak için belirtmeniz myColl[2]gerekir.

Ayrıca bkz.

Şunlara uygulanır

Item[String]

Kaynak:
PropertyDescriptorCollection.cs
Kaynak:
PropertyDescriptorCollection.cs
Kaynak:
PropertyDescriptorCollection.cs

belirtilen adla öğesini PropertyDescriptor alır veya ayarlar.

public:
 virtual property System::ComponentModel::PropertyDescriptor ^ default[System::String ^] { System::ComponentModel::PropertyDescriptor ^ get(System::String ^ name); };
public virtual System.ComponentModel.PropertyDescriptor this[string name] { get; }
public virtual System.ComponentModel.PropertyDescriptor? this[string name] { get; }
member this.Item(string) : System.ComponentModel.PropertyDescriptor
Default Public Overridable ReadOnly Property Item(name As String) As PropertyDescriptor

Parametreler

name
String

Koleksiyondan alınacak öğesinin adı PropertyDescriptor .

Özellik Değeri

PropertyDescriptor belirtilen ada sahip veya null özelliği yoksa.

Örnekler

Aşağıdaki kod örneği, dizin tarafından belirtilen bileşenin türünü yazdırmak için PropertyDescriptor özelliğini kullanırItem[]. Bunu gerektirir button1 ve textBox1 bir formda örneklenmiştir.

void PrintIndexItem2()
{
   
   // Creates a new collection and assigns it the properties for button1.
   PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 );
   
   // Sets a PropertyDescriptor to the specific property.
   PropertyDescriptor^ myProperty = properties[ "Opacity" ];
   
   // Prints the display name for the property.
   textBox1->Text = myProperty->DisplayName;
}
private void PrintIndexItem2() {
   // Creates a new collection and assigns it the properties for button1.
   PropertyDescriptorCollection properties =
       TypeDescriptor.GetProperties(button1);

   // Sets a PropertyDescriptor to the specific property.
   PropertyDescriptor myProperty = properties["Opacity"];

   // Prints the display name for the property.
   textBox1.Text = myProperty.DisplayName;
}
Private Sub PrintIndexItem2()
    ' Creates a new collection and assigns it the properties for button1.
    Dim properties As PropertyDescriptorCollection = _
       TypeDescriptor.GetProperties(button1)
       
    ' Sets a PropertyDescriptor to the specific property.
    Dim myProperty As PropertyDescriptor = properties("Opacity")
       
    ' Prints the display name for the property.
    textBox1.Text = myProperty.DisplayName
End Sub

Açıklamalar

Item[] adlar aranırken özelliği büyük/küçük harfe duyarlıdır. Başka bir ifadeyle, "Pname" ve "pname" adları iki farklı özellik olarak kabul edilir.

Ayrıca bkz.

Şunlara uygulanır