This documentation is archived and is not being maintained.

PropertyDescriptor Class

Provides an abstraction of a property on a class.

For a list of all members of this type, see PropertyDescriptor Members.


[Visual Basic]
MustInherit Public Class PropertyDescriptor
   Inherits MemberDescriptor
public abstract class PropertyDescriptor : MemberDescriptor
public __gc __abstract class PropertyDescriptor : public
abstract class PropertyDescriptor extends MemberDescriptor

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


A description of a property consists of a name, its attributes, the component class that the property is associated with, and the type of the property.

PropertyDescriptor provides the following properties and methods:

PropertyDescriptor also provides the following abstract (MustOverride in Visual Basic) properties and methods:

  • ComponentType contains the type of component this property is bound to.
  • IsReadOnly indicates whether this property is read-only.
  • PropertyType gets the type of the property.
  • CanResetValue indicates whether resetting the component changes the value of the component.
  • GetValue returns the current value of the property on a component.
  • ResetValue resets the value for this property of the component.
  • SetValue sets the value of the component to a different value.
  • ShouldSerializeValue indicates whether the value of this property needs to be persisted.

Typically, the abstract (MustOverride in Visual Basic) members are implemented through reflection. For more information about reflection, see Discovering Type Information at Run Time.


[Visual Basic, C#, C++] The following example is built upon the example in the PropertyDescriptorCollection class. It prints the information (category, description, display name) of the Text of a button in a text box. It assumes that button1 and textbox1 have been instantiated on a form.

[Visual Basic] 
' Creates a new collection and assign it the properties for button1.
Dim properties As PropertyDescriptorCollection = TypeDescriptor.GetProperties(Button1)

' Sets an PropertyDescriptor to the specific property.
Dim myProperty As PropertyDescriptor = properties.Find("Text", False)

' Prints the property and the property description.
TextBox1.Text += myProperty.DisplayName & Microsoft.VisualBasic.ControlChars.Cr
TextBox1.Text += myProperty.Description & Microsoft.VisualBasic.ControlChars.Cr
TextBox1.Text += myProperty.Category & Microsoft.VisualBasic.ControlChars.Cr

// Creates a new collection and assign it the properties for button1.
PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(button1);

// Sets an PropertyDescriptor to the specific property.
System.ComponentModel.PropertyDescriptor myProperty = properties.Find("Text", false);

// Prints the property and the property description.
textBox1.Text = myProperty.DisplayName+ '\n' ;
textBox1.Text += myProperty.Description + '\n';
textBox1.Text += myProperty.Category + '\n';

// Creates a new collection and assign it the properties for button1.
PropertyDescriptorCollection* properties = TypeDescriptor::GetProperties(button1);

// Sets an PropertyDescriptor to the specific property.
System::ComponentModel::PropertyDescriptor* myProperty = properties->Find(S"Text", false);

// Prints the property and the property description.
textBox1->Text = String::Concat( myProperty->DisplayName, S"\n" ) ;
textBox1->Text = String::Concat( textBox1->Text, myProperty->Description, S"\n" );
textBox1->Text = String::Concat( textBox1->Text, myProperty->Category, S"\n" );

[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.


Namespace: System.ComponentModel

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework

Assembly: System (in System.dll)

See Also

PropertyDescriptor Members | System.ComponentModel Namespace | MemberDescriptor | Attribute | DefaultValueAttribute