Share via


IDesignerSerializationManager.CreateInstance 方法

定義

建立指定型別的執行個體,並將它加入具名執行個體的集合。

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

參數

type
Type

要建立的資料型別。

arguments
ICollection

要傳送給這個型別的建構函式的引數。

name
String

物件的名稱。 之後便可經由 GetInstance(String),用這個名稱存取物件。 如果傳遞的是 null,物件還是可以建立,但是無法以名稱存取。

addToContainer
Boolean

如果為 true,會將這個物件加入設計容器中。 物件必須實作 IComponent,才能發生效用。

傳回

新建立的物件執行個體。

備註

如果 addToContainer 參數為 true,則會將實IComponent作的物件新增至設計時間容器。

適用於