Open sandboxFocus

Method MakeGenericInstance

MakeGenericInstance(INamedType, params Type[])

Constructs a generic instance of an INamedType, with type arguments given as reflection Type objects.

Declaration
public static INamedType MakeGenericInstance(this INamedType type, params Type[] typeArguments)
Parameters
Type Name Description
INamedType type

The generic type definition.

Type[] typeArguments

The type arguments to substitute.

Returns
Type Description
INamedType

A constructed generic type.

MakeGenericInstance(INamedType, params IType[])

Constructs a generic instance of an INamedType, with type arguments given as IType objects.

Declaration
public static INamedType MakeGenericInstance(this INamedType type, params IType[] typeArguments)
Parameters
Type Name Description
INamedType type

The generic type definition.

IType[] typeArguments

The type arguments to substitute.

Returns
Type Description
INamedType

A constructed generic type.

MakeGenericInstance(INamedType, IReadOnlyList<Type>)

Constructs a generic instance of an INamedType, with type arguments given as a list of reflection Type objects.

Declaration
public static INamedType MakeGenericInstance(this INamedType type, IReadOnlyList<Type> typeArguments)
Parameters
Type Name Description
INamedType type

The generic type definition.

IReadOnlyList<Type> typeArguments

The type arguments to substitute.

Returns
Type Description
INamedType

A constructed generic type.

MakeGenericInstance(IMethod, IReadOnlyList<Type>)

Declaration
[Obsolete("Use MakeGenericInstance instead.")]
public static IMethod MakeGenericInstance(this IMethod method, IReadOnlyList<Type> typeArguments)
Parameters
Type Name Description
IMethod method
IReadOnlyList<Type> typeArguments
Returns
Type Description
IMethod

MakeGenericInstance(IMethod, params Type[])

Constructs a generic instance of an IMethod, with type arguments given as reflection Type objects.

Declaration
public static IMethod MakeGenericInstance(this IMethod method, params Type[] typeArguments)
Parameters
Type Name Description
IMethod method

The generic method definition.

Type[] typeArguments

The type arguments to substitute.

Returns
Type Description
IMethod

A constructed generic method.

MakeGenericInstance(IMethod, params IType[])

Constructs a generic instance of an IMethod, with type arguments given as IType objects.

Declaration
public static IMethod MakeGenericInstance(this IMethod method, params IType[] typeArguments)
Parameters
Type Name Description
IMethod method

The generic method definition.

IType[] typeArguments

The type arguments to substitute.

Returns
Type Description
IMethod

A constructed generic method.