public static Object CreateInstance(
Type type,
Type[]? genericParameters,
ReflectionWays way = ReflectionWays.Auto
)Public Shared Function CreateInstance (
type As Type,
genericParameters As Type(),
Optional way As ReflectionWays = ReflectionWays.Auto
) As Objectpublic:
static Object^ CreateInstance(
Type^ type,
array<Type^>^ genericParameters,
ReflectionWays way = ReflectionWays::Auto
)static member CreateInstance :
type : Type *
genericParameters : Type[] *
?way : ReflectionWays
(* Defaults:
let _way = defaultArg way ReflectionWays.Auto
*)
-> Object If you are not sure whether the type can be created without constructor parameters or by the provided genericParameters, then you can use the TryCreateInstance methods instead.
If way is Auto, then this method uses the DynamicDelegate way.