How do you provide ‘dynamic’ default values

Platform: WinForms| Category: Tips

Provide ShouldSerialize#PropertyName# and Reset#PropertyName# along with your property.

Example:


private bool ShouldSerializeFont()
{
	return this.bFontSet;
}

/// 
/// Resets the  property to its default value.
/// 
private void ResetFont()
{
	this.localFont = null;
}

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.