Class Activator
Contains methods to create types of objects locally. This class cannot be inherited.
Inherited Members
Namespace: System
Assembly: nanoFramework.DependencyInjection.dll
Syntax
public static class Activator
Methods
CreateInstance(string)
Creates an instance of the type whose name is specified, using the named assembly.
Declaration
public static object CreateInstance(string typename)
Parameters
Type | Name | Description |
---|---|---|
string | typename | The fully qualified name of the type to create an instance of. |
Returns
Type | Description |
---|---|
object |
CreateInstance(Type)
Creates an instance of the specified type using that type's parameterless constructor.
Declaration
public static object CreateInstance(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The type of object to create. |
Returns
Type | Description |
---|---|
object |
CreateInstance(Type, params object[])
Creates an instance of the specified type using the constructor that best matches the specified parameters.
Declaration
public static object CreateInstance(Type type, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The type of object to create. |
object[] | args | An array of arguments that match in number, order, and type the parameters of the constructor to invoke.
If |
Returns
Type | Description |
---|---|
object |
CreateInstance(Type, Type[], params object[])
Creates an instance of the specified type using the constructor that best matches the specified parameters.
Declaration
public static object CreateInstance(Type type, Type[] types, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The type of object to create. |
Type[] | types | An array of Type objects representing the number, order, and type of the parameters for the desired constructor. If types is an empty array or null, to get constructor that takes no parameters. |
object[] | args | An array of arguments that match in number, order, and type the parameters of the constructor to invoke.
If |
Returns
Type | Description |
---|---|
object |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|