Thursday, August 03, 2006

DesignerSerializationVisibility attribute

When writing .NET components, often you don't want properties to appear in the Property Window. This is well documented and is achieved with the following [Browsable(false)] But what you also generally want to happen is for the property not to get persisted to the form in the InitializeComponent method. Unfortunately the Browsable attribute doesn't do this part of the job, but thanks to one of my colleagues, this is how you achieve that. [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] Perhaps there are occasions where these would be used separately but I can't think when they'd be

No comments: