TypeConverter.SimplePropertyDescriptor.CanResetValue(Object) 方法

定义

返回重置组件是否会更改该组件的值。Returns whether resetting the component changes the value of the component.

public:
 override bool CanResetValue(System::Object ^ component);
public override bool CanResetValue (object component);
override this.CanResetValue : obj -> bool
Public Overrides Function CanResetValue (component As Object) As Boolean

参数

component
Object

要测试重置功能的组件。The component to test for reset capability.

返回

如果重置组件更改该组件的值,则为 true;否则为 falsetrue if resetting the component changes the value of the component; otherwise, false.

注解

此方法查找 DefaultValueAttributeThis method looks for a DefaultValueAttribute. 如果找到一个,它会将属性的值与属性的当前值进行比较。If it finds one, it compares the value of the attribute with the current value of the property. 当默认值与属性的当前值不匹配时,它将返回 trueIt returns true when the default value does not match the current value of the property. 如果此方法找不到 DefaultValueAttribute,则将查找 ShouldSerializeMyProperty 方法。If this method cannot find a DefaultValueAttribute, it looks for a ShouldSerializeMyProperty method. 如果找到 ShouldSerializeMyProperty 方法,它将返回 ShouldSerializeMyProperty 返回的内容。If it finds a ShouldSerializeMyProperty method, it returns what ShouldSerializeMyProperty returns. 如果此方法找不到 ShouldSerializeMyProperty 方法,将查找 ResetMyProperty 方法。If this method cannot find a ShouldSerializeMyProperty method, it looks for a ResetMyProperty method. 如果找到 ResetMyProperty 方法,它将返回 trueIf it finds a ResetMyProperty method, it returns true. 如果此方法找不到 DefaultValueAttributeShouldSerializeMyProperty 方法或 ResetMyProperty 方法,则它将返回 falseIf this method cannot find a DefaultValueAttribute, a ShouldSerializeMyProperty method, or a ResetMyProperty method, then it returns false.

适用于

另请参阅