NewItemFactory.CreateInstance 方法

建立所指定 Type 的執行個體,而該執行個體可以加入至集合編輯器或子屬性編輯器。

命名空間:  Microsoft.Windows.Design.PropertyEditing
組件:  Microsoft.Windows.Design.Interaction (在 Microsoft.Windows.Design.Interaction.dll 中)

語法

'宣告
Public Overridable Function CreateInstance ( _
    type As Type _
) As Object
public virtual Object CreateInstance(
    Type type
)
public:
virtual Object^ CreateInstance(
    Type^ type
)
abstract CreateInstance : 
        type:Type -> Object 
override CreateInstance : 
        type:Type -> Object 
public function CreateInstance(
    type : Type
) : Object

參數

  • type
    型別:System.Type
    要建立的物件型別。

傳回值

型別:System.Object
如果找到 type 的建構函式,則會傳回 type 的執行個體,否則傳回 nullNull 參照 (即 Visual Basic 中的 Nothing)。

例外狀況

例外狀況 條件
ArgumentNullException

type 為 nullNull 參照 (即 Visual Basic 中的 Nothing)。

備註

預設實作會搜尋未採用任何引數的公用建構函式。

.NET Framework 安全性

請參閱

參考

NewItemFactory 類別

Microsoft.Windows.Design.PropertyEditing 命名空間

GetConstructor

其他資源

WPF 設計工具擴充性