TypesExtensionsIsClosedTypeOf Method

Simple Injector
Returns true is there is a closed version of the supplied genericTypeDefinition that is assignable from the current type. This method returns true when either type itself, one of its base classes or one of its implemented interfaces is a closed version of genericTypeDefinition; otherwise false.

Namespace:  SimpleInjector
Assembly:  SimpleInjector (in SimpleInjector.dll) Version: 4.0.0
Syntax

public static bool IsClosedTypeOf(
	this Type type,
	Type genericTypeDefinition
)

Parameters

type
Type: SystemType
The type to check.
genericTypeDefinition
Type: SystemType
The generic type definition to match.

Return Value

Type: Boolean
True when type is assignable; otherwise false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Type. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also

Reference