Using the DefaultValue Attribute for Custom Properties
If you are creating custom properties for Web Parts, and those properties use simple types, you can define default property values using the DefaultValue attribute.
If your custom properties use complex types, or if you expect others to derive from your WebPart class, you should define a ShouldSerializeXXX method for each of your custom properties (for more information, see Using ShouldSerializeXXX methods).
Additionally, do not use the DefaultValue attribute if you want properties to be accessible through the Web Part Page Services Component (WPSC). If it exists and a property is set to the default, the property won't appear in the WPSC Properties collection. In this case, provide a ShouldSerializeXXX method for your property.
Note You must provide either the DefaultValue attribute or the ShouldSerializeXXX method for your Web Part custom properties. If neither is found, an exception is raised.