PropertyDescriptorCollection.Item Property (String)


Gets or sets the PropertyDescriptor with the specified name.

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

public virtual PropertyDescriptor this[
	string name
] { get; }


Type: System.String

The name of the PropertyDescriptor to get from the collection.

Property Value

Type: System.ComponentModel.PropertyDescriptor

The PropertyDescriptor with the specified name, or null if the property does not exist.

The Item property is case-sensitive when searching for names. That is, the names "Pname" and "pname" are considered to be two different properties.

The following code example uses the Item property to print the type of component for the PropertyDescriptor specified by the index. It requires that button1 and textBox1 have been instantiated on a form.

private void PrintIndexItem2() {
   // Creates a new collection and assigns it the properties for button1.
   PropertyDescriptorCollection properties =

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

   // Prints the display name for the property.
   textBox1.Text = myProperty.DisplayName;

.NET Framework
Available since 1.1
Return to top