IDesignerSerializationManager.CreateInstance Method

Definition

Creates an instance of the specified type and adds it to a collection of named instances.

C#
public object CreateInstance(Type type, System.Collections.ICollection? arguments, string? name, bool addToContainer);
C#
public object CreateInstance(Type type, System.Collections.ICollection arguments, string name, bool addToContainer);

Parameters

type
Type

The data type to create.

arguments
ICollection

The arguments to pass to the constructor for this type.

name
String

The name of the object. This name can be used to access the object later through GetInstance(String). If null is passed, the object is still created but cannot be accessed by name.

addToContainer
Boolean

If true, this object is added to the design container. The object must implement IComponent for this to have any effect.

Returns

The newly created object instance.

Remarks

Objects that implement IComponent are added to the design-time container if the addToContainer parameter is true.

Applies to

Product Versions
.NET Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1