Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Extension method: bool TryGetGenericParameters(this Type, Type, out Type[])

Declaration

public static bool TryGetGenericParameters(
    this Type type,
    Type typeToFind,
    out Type[] typeParameters
)

Summary

Determines whether the current type is, derives from, or implements the specified generic type, and determines that type’s generic type parameters.

Parameters

this Typetype The current type.
TypetypeToFind A generic type definition for a base type of interface, e.g. typeof(ICollection<>) or typeof(IDictionary<,>).
out Type[]typeParameters Receives an array containing the generic type parameters of the generic type.

Returns

true if the current type is, derives from or implements the specified generic type.