I have a piece of code that goes something like this:
[DefaultValue(false)]
public bool Property
{
set
{
blah = value;
someControl.Vi
Two options;
in the latter, you might want a bool? to track "explicit set" vs "implicit default":
private bool? property;
public bool Property
{
set
{
property = value;
someControl.Visible = value;
}
get
{
return property.GetValueOrDefault();
}
}
public void ResetProperty() { property = null; }
public bool ShouldSerializeProperty() { return property.HasValue; }
Note that Reset* and ShouldSerialize* are patterns recognized by the component-model.