This topic has not yet been rated - Rate this topic

DesignerSerializationManager.PreserveNames Property

Gets or sets a value indicating whether the CreateInstance method should check for the presence of the given name in the container.

Namespace:  System.ComponentModel.Design.Serialization
Assembly:  System.Design (in System.Design.dll)
public bool PreserveNames { get; set; }

Property Value

Type: System.Boolean
true if CreateInstance will pass the given component name; false if CreateInstance will check for the presence of the given name in the container. The default is true.
Exception Condition
InvalidOperationException

This property was changed from within a serialization session.

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.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ