DesignerSerializationManager.CreateInstance Method
Creates an instance of a type.
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.
| 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.
- 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.