Activator..::..CreateInstance<(Of <(<'T>)>)> Method
Creates an instance of the type designated by the specified generic type parameter, using the parameterless constructor.
Namespace:
SystemAssembly: Bridge (in Bridge.dll)
Syntax
[TemplateAttribute] public static T CreateInstance<T>()
<TemplateAttribute> _ Public Shared Function CreateInstance(Of T) As T
[TemplateAttribute] public: generic<typename T> static T CreateInstance()
Type Parameters
- T
- The type to create.
Return Value
A reference to the newly created object.Exceptions
Exception | Condition |
---|---|
MissingMethodException | In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, MissingMemberException, instead.The type that is specified for T does not have a parameterless constructor. |