Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

PropertyDescriptorCollection.Item Property (String)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the PropertyDescriptor with the specified name.

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

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

Parameters

name
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 =
       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;
}

.NET Framework
Available since 1.1
Return to top
Show:
© 2018 Microsoft