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.InternalAssembly: CMS.DataEngine (in CMS.DataEngine.dll) Version: 13.0.131
Syntax 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:
TypeReturns 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 Exception | Condition |
---|
ArgumentNullException | Thrown when type or genericTypeDefinition is null. |
ArgumentException | Thrown when type represented by genericTypeDefinition is not a generic type definition. |
See Also Reference
TypeGetGenericTypeDefinition
TypeIsGenericTypeDefinition