Primitively Primitively
Primitively Primitively
DocFX + Singulink = ♥

Search Results for

    Class TypeExtensions

    This static class that provides extension methods for the Type class.

    Inheritance
    object
    TypeExtensions
    Namespace: Primitively
    Assembly: Primitively.Abstractions.dll
    Syntax
    public static class TypeExtensions
    Remarks

    This class provides the method IsAssignableTo(Type, Type) which is missing from .NET Standard.

    Methods

    IsAssignableTo(Type, Type)

    Determines whether an instance of the current Type can be assigned to a variable of the specified targetType.

    Declaration
    public static bool IsAssignableTo(this Type type, Type targetType)
    Parameters
    Type Name Description
    Type type

    The current type.

    Type targetType

    The type to compare with the current type.

    Returns
    Type Description
    bool

    true if any of the following conditions is true:

    • The current instance and targetType represent the same type.
    • The current type is derived either directly or indirectly from targetType.
    • targetType is an interface that the current type implements.
    • The current type is a generic type parameter, and targetType represents one of the constraints of the current type.
    • The current type represents a value type, and targetType represents Nullable<T>. false if none of these conditions are true, or if targetType is null.
    © Electronic Hands. All rights reserved.