Class Activator
- Namespace
- System
- Assembly
- nanoFramework.DependencyInjection.dll
Contains methods to create types of objects locally. This class cannot be inherited.
public static class Activator
- Inheritance
-
Activator
- Inherited Members
Methods
CreateInstance(string)
Creates an instance of the type whose name is specified, using the named assembly.
public static object CreateInstance(string typename)
Parameters
typename
stringThe fully qualified name of the type to create an instance of.
Returns
CreateInstance(Type)
Creates an instance of the specified type using that type's parameterless constructor.
public static object CreateInstance(Type type)
Parameters
type
TypeThe type of object to create.
Returns
CreateInstance(Type, params object[])
Creates an instance of the specified type using the constructor that best matches the specified parameters.
public static object CreateInstance(Type type, params object[] args)
Parameters
type
TypeThe type of object to create.
args
object[]An array of arguments that match in number, order, and type the parameters of the constructor to invoke. If
args
is an empty array or null, the constructor that takes no parameters (the parameterless constructor) is invoked.
Returns
CreateInstance(Type, Type[], params object[])
Creates an instance of the specified type using the constructor that best matches the specified parameters.
public static object CreateInstance(Type type, Type[] types, params object[] args)
Parameters
type
TypeThe type of object to create.
types
Type[]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.
args
object[]An array of arguments that match in number, order, and type the parameters of the constructor to invoke. If
args
is an empty array or null, the constructor that takes no parameters (the parameterless constructor) is invoked.
Returns
Exceptions
- ArgumentNullException
type
can't be null.