Class DynamicPropertyDescriptor
Provides a virtual property for a class.
public class DynamicPropertyDescriptor : PropertyDescriptor
- Inheritance
-
DynamicPropertyDescriptor
- Inherited Members
Constructors
DynamicPropertyDescriptor(string, Type, Func<object, object>, Action<object, object>, params Attribute[])
Initializes a new instance of the DynamicPropertyDescriptor class using the specified name, type, and dynamic methods for getting and setting property values.
public DynamicPropertyDescriptor(string name, Type type, Func<object, object> getter, Action<object, object> setter, params Attribute[] attributes)
Parameters
namestringThe name of the dynamic property.
typeTypeThe type of the dynamic property.
getterFunc<object, object>A method used to get the current value of the dynamic property.
setterAction<object, object>A method used to set the value of the dynamic property to a different value.
attributesAttribute[]An optional array of Attribute objects that contains the property attributes.
Properties
ComponentType
Gets the type of the component this property is bound to.
public override Type ComponentType { get; }
Property Value
IsReadOnly
Gets a value indicating whether this property is read-only.
public override bool IsReadOnly { get; }
Property Value
PropertyType
Gets the type of the dynamic property.
public override Type PropertyType { get; }
Property Value
Methods
CanResetValue(object)
Returns whether resetting an object changes its value. Dynamic properties do not support resetting, so resetting an object never changes its value.
public override bool CanResetValue(object component)
Parameters
componentobjectThe component to test for reset capability.
Returns
GetValue(object)
Gets the current value of the property on a component.
public override object GetValue(object component)
Parameters
componentobjectThe component with the property for which to retrieve the value.
Returns
- object
The value of a property for a given component.
ResetValue(object)
Resets the value for this property of the component to the default value. Dynamic properties do not support resetting their values.
public override void ResetValue(object component)
Parameters
componentobjectThe component with the property value that is to be reset to the default value.
SetValue(object, object)
Sets the value of the dynamic property to a different value.
public override void SetValue(object component, object value)
Parameters
componentobjectThe component with the property value that is to be set.
valueobjectThe new value.
ShouldSerializeValue(object)
Determines a value indicating whether the value of this property needs to be persisted. Dynamic property values are transient, so they always need to be persisted.
public override bool ShouldSerializeValue(object component)
Parameters
componentobjectThe component with the property to be examined for persistence.