PropertyDescriptor Class

 

Provides an abstraction of a property on a class.

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


[<AbstractClass>]
[<ComVisibleAttribute(true)>]
[<HostProtectionAttribute(SecurityAction.LinkDemand, SharedState = true)>]
type PropertyDescriptor = 
    class
        inherit MemberDescriptor
    end

NameDescription
System_CAPS_protmethodPropertyDescriptor(MemberDescriptor)

Initializes a new instance of the PropertyDescriptor class with the name and attributes in the specified MemberDescriptor.

System_CAPS_protmethodPropertyDescriptor(MemberDescriptor, Attribute[])

Initializes a new instance of the PropertyDescriptor class with the name in the specified MemberDescriptor and the attributes in both the MemberDescriptor and the Attribute array.

System_CAPS_protmethodPropertyDescriptor(String, Attribute[])

Initializes a new instance of the PropertyDescriptor class with the specified name and attributes.

NameDescription
System_CAPS_protpropertyAttributeArray

Gets or sets an array of attributes.(Inherited from MemberDescriptor.)

System_CAPS_pubpropertyAttributes

Gets the collection of attributes for this member.(Inherited from MemberDescriptor.)

System_CAPS_pubpropertyCategory

Gets the name of the category to which the member belongs, as specified in the CategoryAttribute.(Inherited from MemberDescriptor.)

System_CAPS_pubpropertyComponentType

When overridden in a derived class, gets the type of the component this property is bound to.

System_CAPS_pubpropertyConverter

Gets the type converter for this property.

System_CAPS_pubpropertyDescription

Gets the description of the member, as specified in the DescriptionAttribute.(Inherited from MemberDescriptor.)

System_CAPS_pubpropertyDesignTimeOnly

Gets whether this member should be set only at design time, as specified in the DesignOnlyAttribute.(Inherited from MemberDescriptor.)

System_CAPS_pubpropertyDisplayName

Gets the name that can be displayed in a window, such as a Properties window.(Inherited from MemberDescriptor.)

System_CAPS_pubpropertyIsBrowsable

Gets a value indicating whether the member is browsable, as specified in the BrowsableAttribute.(Inherited from MemberDescriptor.)

System_CAPS_pubpropertyIsLocalizable

Gets a value indicating whether this property should be localized, as specified in the LocalizableAttribute.

System_CAPS_pubpropertyIsReadOnly

When overridden in a derived class, gets a value indicating whether this property is read-only.

System_CAPS_pubpropertyName

Gets the name of the member.(Inherited from MemberDescriptor.)

System_CAPS_protpropertyNameHashCode

Gets the hash code for the name of the member, as specified in GetHashCode.(Inherited from MemberDescriptor.)

System_CAPS_pubpropertyPropertyType

When overridden in a derived class, gets the type of the property.

System_CAPS_pubpropertySerializationVisibility

Gets a value indicating whether this property should be serialized, as specified in the DesignerSerializationVisibilityAttribute.

System_CAPS_pubpropertySupportsChangeEvents

Gets a value indicating whether value change notifications for this property may originate from outside the property descriptor.

NameDescription
System_CAPS_pubmethodAddValueChanged(Object, EventHandler)

Enables other objects to be notified when this property changes.

System_CAPS_pubmethodCanResetValue(Object)

When overridden in a derived class, returns whether resetting an object changes its value.

System_CAPS_protmethodCreateAttributeCollection()

Creates a collection of attributes using the array of attributes passed to the constructor.(Inherited from MemberDescriptor.)

System_CAPS_protmethodCreateInstance(Type)

Creates an instance of the specified type.

System_CAPS_pubmethodEquals(Object)

Compares this to another object to see if they are equivalent.(Overrides MemberDescriptor.Equals(Object).)

System_CAPS_protmethodFillAttributes(IList)

Adds the attributes of the PropertyDescriptor to the specified list of attributes in the parent class.(Overrides MemberDescriptor.FillAttributes(IList).)

System_CAPS_protmethodFinalize()

Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.(Inherited from Object.)

System_CAPS_pubmethodGetChildProperties()

Returns the default PropertyDescriptorCollection.

System_CAPS_pubmethodGetChildProperties(Attribute[])

Returns a PropertyDescriptorCollection using a specified array of attributes as a filter.

System_CAPS_pubmethodGetChildProperties(Object)

Returns a PropertyDescriptorCollection for a given object.

System_CAPS_pubmethodGetChildProperties(Object, Attribute[])

Returns a PropertyDescriptorCollection for a given object using a specified array of attributes as a filter.

System_CAPS_pubmethodGetEditor(Type)

Gets an editor of the specified type.

System_CAPS_pubmethodGetHashCode()

Returns the hash code for this object.(Overrides MemberDescriptor.GetHashCode().)

System_CAPS_protmethodGetInvocationTarget(Type, Object)

This method returns the object that should be used during invocation of members.(Overrides MemberDescriptor.GetInvocationTarget(Type, Object).)

System_CAPS_pubmethodGetType()

Gets the Type of the current instance.(Inherited from Object.)

System_CAPS_protmethodGetTypeFromName(String)

Returns a type using its name.

System_CAPS_pubmethodGetValue(Object)

When overridden in a derived class, gets the current value of the property on a component.

System_CAPS_protmethodGetValueChangedHandler(Object)

Retrieves the current set of ValueChanged event handlers for a specific component

System_CAPS_protmethodMemberwiseClone()

Creates a shallow copy of the current Object.(Inherited from Object.)

System_CAPS_protmethodOnValueChanged(Object, EventArgs)

Raises the ValueChanged event that you implemented.

System_CAPS_pubmethodRemoveValueChanged(Object, EventHandler)

Enables other objects to be notified when this property changes.

System_CAPS_pubmethodResetValue(Object)

When overridden in a derived class, resets the value for this property of the component to the default value.

System_CAPS_pubmethodSetValue(Object, Object)

When overridden in a derived class, sets the value of the component to a different value.

System_CAPS_pubmethodShouldSerializeValue(Object)

When overridden in a derived class, determines a value indicating whether the value of this property needs to be persisted.

System_CAPS_pubmethodToString()

Returns a string that represents the current object.(Inherited from Object.)

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 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 members are implemented through reflection. For more information about reflection, see the topics in Reflection in the .NET Framework.

The following code 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.

No code example is currently available or this language may not be supported.

The following code example shows how to implement a custom property descriptor that provides a read-only wrapper around a property. The SerializeReadOnlyPropertyDescriptor is used in a custom designer to provide a read-only property descriptor for the control's Size property.

No code example is currently available or this language may not be supported.

The following code examples show how to use the The SerializeReadOnlyPropertyDescriptor in a custom designer.

No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0

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

Return to top
Show: