System.ComponentModel.DesignerSerializationVisibilityAttribute Class

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

See Also: DesignerSerializationVisibilityAttribute Members

Syntax

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

Remarks

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 System.ComponentModel.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 System.ComponentModel.DesignerSerializationVisibilityAttribute will be treated as though they have a System.ComponentModel.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 System.ComponentModel.Design.Serialization.DesignerSerializerAttribute.

For more information, see Extending Metadata Using Attributes.

Requirements

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