System.ComponentModel.DesignerSerializationVisibilityAttribute Class

Specifies the type of persistence to use when serializing a property on a component at design time.

See Also: DesignerSerializationVisibilityAttribute


[System.AttributeUsage(System.AttributeTargets.Method | System.AttributeTargets.Property | System.AttributeTargets.Field | System.AttributeTargets.Event | System.AttributeTargets.All)]
public sealed class DesignerSerializationVisibilityAttribute : Attribute


When a serializer persists the persistable state of a design mode document, it often adds code to the initialization method of components to persist values of properties that have been set at design time. This happens by default for most basic types, if no attribute has been set to direct other behavior.

With the DesignerSerializationVisibilityAttribute, you can indicate whether the value for a property is DesignerSerializationVisibilityAttribute.Visible, and should be persisted in initialization code, DesignerSerializationVisibilityAttribute.Hidden, and should not be persisted in initialization code, or consists of DesignerSerializationVisibilityAttribute.Content, which should have initialization code generated for each public, not hidden property of the object assigned to the property.

Members that do not have a DesignerSerializationVisibilityAttribute will be treated as though they have a DesignerSerializationVisibilityAttribute with a value of DesignerSerializationVisibility.Visible. The values of a property marked as DesignerSerializationVisibility.Visible will be serialized, if possible, by a serializer for the type. To specify custom serialization for a particular type or property, use the DesignerSerializerAttribute.

For more information, see Extending Metadata Using Attributes.


Namespace: System.ComponentModel
Assembly: System (in System.dll)
Assembly Versions: 1.0.3300.0, 1.0.5000.0,,

The members of System.ComponentModel.DesignerSerializationVisibilityAttribute are listed below.

See Also: Attribute

Public Constructors

Public Fields

static readonly

Specifies that a serializer should serialize the contents of the property, rather than the property itself. This field is read-only.

static readonly

Specifies the default value, which is DesignerSerializationVisibilityAttribute.Visible, that is, a visual designer uses default rules to generate the value of a property. This static field is read-only.

static readonly

Specifies that a serializer should not serialize the value of the property. This static field is read-only.

static readonly

Specifies that a serializer should be allowed to serialize the value of the property. This static field is read-only.

Public Properties


Gets a value indicating the basic serialization mode a serializer should use when determining whether and how to persist the value of a property.

Public Methods

Equals(Object) : Boolean

Indicates whether this instance and a specified object are equal.

GetHashCode() : Int32

Returns the hash code for this object.

IsDefaultAttribute() : Boolean

Gets a value indicating whether the current value of the attribute is the default value for the attribute.