TypesExtensionsGetClosedTypesOf Method

Simple Injector
Gets the list of closed versions of genericTypeDefinition that the current type is assignable from. Example: When type is a type class X : IX<int>, IFoo<string> and genericTypeDefinition is type IX<T>: this method will return type IX<int>.

Namespace:  SimpleInjector
Assembly:  SimpleInjector (in SimpleInjector.dll) Version: 5.3.0

public static Type[] GetClosedTypesOf(
	this Type type,
	Type genericTypeDefinition


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

Return Value

Type: Type
A list of matching closed generic types.

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