IDesignerSerializationManager.CreateInstance(Type, ICollection, String, Boolean) 方法

定义

创建指定类型的实例并将其添加到已命名实例的集合中。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);
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

要创建的数据类型。The data type to create.

arguments
ICollection

要传递到此类型的构造函数的参数。The arguments to pass to the constructor for this type.

name
String

对象的名称。The name of the object. 此名称可用于以后通过 GetInstance(String) 访问该对象。This name can be used to access the object later through GetInstance(String). 如果传递了 null,则仍将创建该对象,但无法按名称访问它。If null is passed, the object is still created but cannot be accessed by name.

addToContainer
Boolean

如果为 true,则该对象将被添加到设计容器中。If true, this object is added to the design container. 该对象必须实现 IComponent 才能使此功能生效。The object must implement IComponent for this to have any effect.

返回

Object

新创建的对象实例。The newly created object instance.

注解

如果参数为,则实现的对象将 IComponent 添加到设计时容器中 addToContainer trueObjects that implement IComponent are added to the design-time container if the addToContainer parameter is true.

适用于