DesignerSerializationManager.RecycleInstances Property
Gets or sets a flag indicating whether CreateInstance will always create a new instance of a type.
Assembly: System.Design (in System.Design.dll)
Property Value
Type: System.Booleantrue 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.
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
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.