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: 5.3.0

public static bool IsClosedTypeOf(
	this Type type,
	Type genericTypeDefinition


Type: SystemType
The type to check.
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