HasImplicitBoxingConversion() public method

public HasImplicitBoxingConversion ( CType pSource, CType pDest ) : bool
pSource CType
pDest CType
return bool
Exemplo n.º 1
0
        /***************************************************************************************************
            Determines whether there is a boxing conversion from typeSrc to typeDst
        
        13.1.5 Boxing conversions
        
        A boxing conversion permits any non-nullable-value-type to be implicitly converted to the type 
        object or System.ValueType or to any interface-type implemented by the non-nullable-value-type, 
        and any enum type to be implicitly converted to System.Enum as well. ... An enum can be boxed to 
        the type System.Enum, since that is the direct base class for all enums (21.4). A struct or enum 
        can be boxed to the type System.ValueType, since that is the direct base class for all 
        structs (18.3.2) and a base class for all enums.
        
        A nullable-type has a boxing conversion to the same set of types to which the nullable-type’s 
        underlying type has boxing conversions. 
        
        For a type-parameter T that is not known to be a reference type (25.7), the following conversions 
        involving T are considered to be boxing conversions at compile-time. At run-time, if T is a value 
        type, the conversion is executed as a boxing conversion. At run-time, if T is a reference type, 
        the conversion is executed as an implicit reference conversion or identity conversion.
        *   From T to its effective base class C, from T to any base class of C, and from T to any 
            interface implemented by C. [Note: C will be one of the types System.Object, System.ValueType, 
            or System.Enum (otherwise T would be known to be a reference type and §13.1.4 would apply 
            instead of this clause). end note]
        *   From T to an interface-type I in T’s effective interface set and from T to any base 
            interface of I.
        ***************************************************************************************************/

        public static bool FBoxingConv(SymbolLoader loader, CType typeSrc, CType typeDst)
        {
            return loader.HasImplicitBoxingConversion(typeSrc, typeDst);
        }
Exemplo n.º 2
0
        /***************************************************************************************************
        *   Determines whether there is a boxing conversion from typeSrc to typeDst
        *
        *  13.1.5 Boxing conversions
        *
        *  A boxing conversion permits any non-nullable-value-type to be implicitly converted to the type
        *  object or System.ValueType or to any interface-type implemented by the non-nullable-value-type,
        *  and any enum type to be implicitly converted to System.Enum as well. ... An enum can be boxed to
        *  the type System.Enum, since that is the direct base class for all enums (21.4). A struct or enum
        *  can be boxed to the type System.ValueType, since that is the direct base class for all
        *  structs (18.3.2) and a base class for all enums.
        *
        *  A nullable-type has a boxing conversion to the same set of types to which the nullable-type’s
        *  underlying type has boxing conversions.
        *
        *  For a type-parameter T that is not known to be a reference type (25.7), the following conversions
        *  involving T are considered to be boxing conversions at compile-time. At run-time, if T is a value
        *  type, the conversion is executed as a boxing conversion. At run-time, if T is a reference type,
        *  the conversion is executed as an implicit reference conversion or identity conversion.
        *   From T to its effective base class C, from T to any base class of C, and from T to any
        *   interface implemented by C. [Note: C will be one of the types System.Object, System.ValueType,
        *   or System.Enum (otherwise T would be known to be a reference type and §13.1.4 would apply
        *   instead of this clause). end note]
        *   From T to an interface-type I in T’s effective interface set and from T to any base
        *   interface of I.
        ***************************************************************************************************/

        public static bool FBoxingConv(SymbolLoader loader, CType typeSrc, CType typeDst)
        {
            return(loader.HasImplicitBoxingConversion(typeSrc, typeDst));
        }