Upraviť

Zdieľať cez


IDesignerSerializationManager.CreateInstance Method

Definition

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

public:
 System::Object ^ CreateInstance(Type ^ type, System::Collections::ICollection ^ arguments, System::String ^ name, bool addToContainer);
public object CreateInstance (Type type, System.Collections.ICollection arguments, string name, bool addToContainer);
public object CreateInstance (Type type, System.Collections.ICollection? arguments, string? name, bool addToContainer);
abstract member CreateInstance : Type * System.Collections.ICollection * string * bool -> obj
Public Function CreateInstance (type As Type, arguments As ICollection, name As String, addToContainer As Boolean) As Object

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