When overridden in a derived class, indicates whether the value of this property needs to be persisted.
[Visual Basic] MustOverride Public Function ShouldPersistValue( _ ByVal component As Object _ ) As Boolean [C#] public abstract bool ShouldPersistValue( object component ); [C++] public: virtual bool ShouldPersistValue( Object* component ) = 0; [JScript] public abstract function ShouldPersistValue( component : Object ) : Boolean;
true when the property should be persisted; otherwise, false.
Typically, this method is implemented through reflection.
Notes to Inheritors: When overridden in a derived class, this method returns true if the current value of the property is different than its default value. It looks for a default value by first looking for a DefaultValueAttribute. If the method finds this attribute, it compares the value of the attribute with the property's current value. If this method cannot find a DefaultValueAttribute, it looks for a ShouldPersist XXX method. If this method finds a ShouldPersist XXX method, it invokes it. If this method cannot find a DefaultValueAttribute or a ShouldPersist XXX method, it cannot create optimizations and it returns true.
PropertyDescriptor Class | PropertyDescriptor Members | System.ComponentModel Namespace