Click or drag to resize
TypeExtensionsFindTypeByGenericDefinition Method
Walks type hierarchy of a type towards base classes and looks for genericTypeDefinition. Returns the type from type's class hierarchy whose generic type definition matches genericTypeDefinition.

Namespace: CMS.DataEngine.Internal
Assembly: CMS.DataEngine (in CMS.DataEngine.dll) Version: 13.0.131
Syntax
C#
public static Type FindTypeByGenericDefinition(
	this Type type,
	Type genericTypeDefinition
)

Parameters

type
Type: SystemType
Type whose class hierarchy to examine.
genericTypeDefinition
Type: SystemType
Generic type definition to look for.

Return Value

Type: Type
Returns type whose generic type definition matches genericTypeDefinition by examining inheritance hierarchy of type. Returns null if no match is found.

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).
Exceptions
ExceptionCondition
ArgumentNullExceptionThrown when type or genericTypeDefinition is null.
ArgumentExceptionThrown when type represented by genericTypeDefinition is not a generic type definition.
See Also

Reference

TypeGetGenericTypeDefinition
TypeIsGenericTypeDefinition