This topic has not yet been rated - Rate this topic

DesignerSerializationManager.RecycleInstances Property

Gets or sets a flag indicating whether CreateInstance will always create a new instance of a type.

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

Property Value

Type: System.Boolean
true if CreateInstance will return the existing instance; false if CreateInstance will create a new instance of a type. The default is false.
Exception Condition
InvalidOperationException

The serialization manager has an active serialization session.

If the RecycleInstances property is false, the CreateInstance method will always create a new instance of a type. If RecycleInstances is true, CreateInstance will first search the name table and container for an object of the same name. If such an object exists and is of the same type, CreateInstance will return the existing instance. This second variation is useful for implementing a serializer that applies serialization state to an existing set of objects, rather than always creating a new tree. The Undo command often uses this type of serializer.

In the case where the RecycleInstances property is true, the ValidateRecycledTypes property will further modify the behavior of CreateInstance depending on the types of the two objects.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ