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
name
stringThe name of the dynamic property.
type
TypeThe type of the dynamic property.
getter
Func<object, object>A method used to get the current value of the dynamic property.
setter
Action<object, object>A method used to set the value of the dynamic property to a different value.
attributes
Attribute[]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
component
objectThe 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
component
objectThe 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
component
objectThe 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
component
objectThe component with the property value that is to be set.
value
objectThe 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
component
objectThe component with the property to be examined for persistence.