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

 

Gets or sets the PropertyDescriptor with the specified name.

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

public:
property PropertyDescriptor^ default[
	String^ name
] {
	virtual PropertyDescriptor^ get(String^ name);
}

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.

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:
© 2017 Microsoft