src/Mimp.SeeSharper.Reflection/TypeExtensions.Inherit.cs
/// <summary>
/// Return true if <paramref name="type"/> inherit from the <paramref name="genericTypeDefinition"/> with the <paramref name="genericTypeArguments"/>.
/// </summary>
/// <param name="type"></param>
/// <param name="genericTypeDefinition"></param>
/// <param name="genericTypeArguments">To ignore the type check on a position use null</param>
/// <returns></returns>
/// <exception cref="ArgumentNullException"></exception>
/// <exception cref="ArgumentException">If <paramref name="genericTypeArguments"/> size isn't equal to generic arguments of <paramref name="genericTypeDefinition"/></exception>
Return true if  inherit from the  with the .
Return true if inherit from the with the .
public static bool InheritGenericDefinition(this Type type, Type genericTypeDefinition, IEnumerable<Type?> genericTypeArguments)
        {
            if (type is null)
                throw new ArgumentNullException(nameof(type));
            if (genericTypeDefinition is null)
                throw new ArgumentNullException(nameof(genericTypeDefinition));
            if (genericTypeArguments is null)
                throw new ArgumentNullException(nameof(genericTypeArguments));
            return type.InheritGenericDefinition(genericTypeDefinition, genericTypeArguments.Select(t => (Func<int, Type, bool>)((i, r) => t.IsNullOrVoid() || t == r)));
        }
public static bool InheritGenericDefinition ( this Type type , Type genericTypeDefinition , IEnumerable < Type ? > genericTypeArguments ) { if ( type is null ) throw new ArgumentNullException ( nameof ( type ) ) ; if ( genericTypeDefinition is null ) throw new ArgumentNullException ( nameof ( genericTypeDefinition ) ) ; if ( genericTypeArguments is null ) throw new ArgumentNullException ( nameof ( genericTypeArguments ) ) ; return type . InheritGenericDefinition ( genericTypeDefinition , genericTypeArguments . Select ( t => ( Func < int , Type , bool > ) ( ( i , r ) => t . IsNullOrVoid ( ) || t == r ) ) ) ; }
Return true if  inherit from the  with the .
Return true if inherit from the with the .
None
None
If  size isn't equal to generic arguments of
If size isn ' t equal to generic arguments of
Type
this
genericTypeDefinition
Type
None
genericTypeArguments
IEnumerable<Type?>
To ignore the type check on a position use null
To ignore the type check on a position use null
type
None