DesignerSerializationManager.PreserveNames Property

Definition

Gets or sets a value indicating whether the CreateInstance(Type, ICollection, String, Boolean) method should check for the presence of the given name in the container.

public:
 property bool PreserveNames { bool get(); void set(bool value); };
public bool PreserveNames { get; set; }
member this.PreserveNames : bool with get, set
Public Property PreserveNames As Boolean

Property Value

true if CreateInstance(Type, ICollection, String, Boolean) will pass the given component name; false if CreateInstance(Type, ICollection, String, Boolean) will check for the presence of the given name in the container. The default is true.

Exceptions

This property was changed from within a serialization session.

Remarks

The PreserveNames property determines the behavior of the CreateInstance method. If true, CreateInstance will pass the given component name. If false, CreateInstance will check for the presence of the given name in the container. If the name does not exist in the container, CreateInstance will use the given name. If the name does exist in the container, CreateInstance will pass a null value as the name of a component when adding it to the container, thereby giving it a new name. This second variation is useful for implementing a serializer that always duplicates objects, rather than assuming those objects do not exist. Paste commands often use this type of serializer.

You can only change this property when you are not in a serialization session.

Applies to

See also