public static Object CreateInstance(
Type type,
Type[]? genericParameters,
params Object?[]? parameters
)
Public Shared Function CreateInstance (
type As Type,
genericParameters As Type(),
ParamArray parameters As Object()
) As Object
public:
static Object^ CreateInstance(
Type^ type,
array<Type^>^ genericParameters,
... array<Object^>^ parameters
)
static member CreateInstance :
type : Type *
genericParameters : Type[] *
parameters : Object[] -> Object
If you are not sure whether the type can be created by the provided genericParameters and parameters, then you can use the TryCreateInstance methods instead.
For creating the instance this method uses the DynamicDelegate way, unless for value types with empty or parameters, in which case the SystemReflection way is selected, which will use the Activator class.