แก้ไข

แชร์ผ่าน


DesignerSerializationManager.ValidateRecycledTypes Property

Definition

Gets or sets a value that indicates whether the CreateInstance(Type, ICollection, String, Boolean) method will verify that matching names refer to the same type.

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

Property Value

true if CreateInstance(Type, ICollection, String, Boolean) verifies types; otherwise, false if it does not. The default is true.

Exceptions

The serialization manager has an active serialization session.

Remarks

The ValidateRecycledTypes property modifies the behavior of the CreateInstance method when the RecycleInstances property is true, as detailed in the following table.

RecycleInstances ValidateRecycledTypes Behavior of CreateInstance
false true or false Always create a new instance of the specified type
true false If a matching instance is found it is returned, regardless of its type.
true true If a matching instance is found, it is returned only if its type is the same as specified in the method call.

ValidateRecycledTypes is useful for morphing one type of object to another if they have similar properties but share no common parent or interface.

Applies to

See also