This topic has not yet been rated - Rate this topic

DesignerSerializationManager.CreateInstance Method

Creates an instance of a type.

Namespace:  System.ComponentModel.Design.Serialization
Assembly:  System.Design (in System.Design.dll)
protected virtual Object CreateInstance(
	Type type,
	ICollection arguments,
	string name,
	bool addToContainer
)

Parameters

type
Type: System.Type
The type to create an instance of.
arguments
Type: System.Collections.ICollection
The parameters of the type’s constructor. This can be null or an empty collection to invoke the default constructor.
name
Type: System.String
A name to give the object. If null, the object will not be given a name, unless the object is added to a container and the container gives the object a name.
addToContainer
Type: System.Boolean
true to add the object to the container if the object implements IComponent; otherwise, false.

Return Value

Type: System.Object
A new instance of the type specified by type.
Exception Condition
SerializationException

type does not have a constructor that takes parameters contained in arguments.

This method is called by serializers when they attempt to create an instance of a type. The default implementation creates a new instance of the type, or it may return an existing instance depending on the values of the PreserveNames and RecycleInstances properties. The CreateInstance method uses reflection to create instances and will perform some generic IConvertible transformations on parameters to find a matching constructor.

.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