IDesignerSerializationManager.CreateInstance 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
创建指定类型的实例并将其添加到命名实例的集合中。
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
要创建的数据类型。
- arguments
- ICollection
要传递给此类型的构造函数的参数。
- name
- String
对象的名称。 此名称可用于稍后通过 GetInstance(String). 访问对象。 如果 null 传递,则仍会创建对象,但无法按名称访问。
- addToContainer
- Boolean
如果 true,此对象将添加到设计容器。 对象必须实现 IComponent 此对象才能产生任何效果。
返回
新建的对象实例。
注解
如果addToContainer参数为 true,则实现IComponent的对象将添加到设计时容器。