Export (0) Print
Expand All

PropertyDescriptorCollection.Item Property

Gets the specified PropertyDescriptor.

[C#] In C#, this property is the indexer for the PropertyDescriptorCollection class.

Overload List

Gets the PropertyDescriptor with the specified name.

[Visual Basic] Overloads Public Overridable Default ReadOnly Property Item(String) As PropertyDescriptor
[C#] public virtual PropertyDescriptor this[string] {get;}
[C++] public: __property virtual PropertyDescriptor* get_Item(String*);
[JScript] PropertyDescriptorCollection.Item (String)

Gets the PropertyDescriptor at the specified index number.

[Visual Basic] Overloads Public Overridable Default ReadOnly Property Item(Integer) As PropertyDescriptor
[C#] public virtual PropertyDescriptor this[int] {get;}
[C++] public: __property virtual PropertyDescriptor* get_Item(int);
[JScript] PropertyDescriptorCollection.Item (int)

Example

[Visual Basic, C#, C++] The following example uses the Item property to print the name of the PropertyDescriptor specified by the index number in a text box. Because the index number is zero-based, this example prints the name of the second PropertyDescriptor. It assumes that button1 has been instantiated on a form.

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of the Item property (PropertyDescriptorCollection indexer). For other examples that might be available, see the individual overload topics.
[Visual Basic] 
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


[C#] 
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();
 }


[C++] 
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->Item[1]->ToString();
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

See Also

PropertyDescriptorCollection Class | PropertyDescriptorCollection Members | System.ComponentModel Namespace

Show:
© 2014 Microsoft