Udostępnij za pośrednictwem


NewItemFactory.CreateInstance Method

Creates an instance of the specified Type that can be added to the collection editor or sub-property editor.

Namespace:  Microsoft.Windows.Design.PropertyEditing
Assembly:  Microsoft.Windows.Design.Interaction (in Microsoft.Windows.Design.Interaction.dll)

Syntax

'Declaration
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

Parameters

  • type
    Type: System.Type
    The type of the object to create.

Return Value

Type: System.Object
If a constructor is found for type, returns an instance of type; otherwise, nulla null reference (Nothing in Visual Basic).

Exceptions

Exception Condition
ArgumentNullException

type is nulla null reference (Nothing in Visual Basic).

Remarks

The default implementation searches for a public constructor that takes no arguments.

.NET Framework Security

See Also

Reference

NewItemFactory Class

Microsoft.Windows.Design.PropertyEditing Namespace

GetConstructor

Other Resources

WPF Designer Extensibility