Ejemplo n.º 1
0
 internal static bool HasImplicitNumericConversion(Type/*!*/ fromType, Type/*!*/ toType) {
     NumericTypeCode toCode = GetNumericTypeCode(toType);
     NumericTypeCode fromCode = GetNumericTypeCode(fromType);
     return toCode != NumericTypeCode.Invalid
         && fromCode != NumericTypeCode.Invalid
         && (ExplicitConversions[(int)fromCode] & (1 << (int)toCode)) == 0;
 }
Ejemplo n.º 2
0
 private static NumericTypeCode[] CreateTypeCodeMapping() {
     var result = new NumericTypeCode[20];
     result[(int)TypeCode.SByte] = NumericTypeCode.SByte;
     result[(int)TypeCode.Byte] = NumericTypeCode.Byte;
     result[(int)TypeCode.Int16] = NumericTypeCode.Int16;
     result[(int)TypeCode.UInt16] = NumericTypeCode.UInt16;
     result[(int)TypeCode.Int32] = NumericTypeCode.Int32;
     result[(int)TypeCode.UInt32] = NumericTypeCode.UInt32;
     result[(int)TypeCode.Int64] = NumericTypeCode.Int64;
     result[(int)TypeCode.UInt64] = NumericTypeCode.UInt64;
     result[(int)TypeCode.Single] = NumericTypeCode.Single;
     result[(int)TypeCode.Double] = NumericTypeCode.Double;
     result[(int)TypeCode.Decimal] = NumericTypeCode.Decimal;
     return result;
 }
Ejemplo n.º 3
0
 private static NumericTypeCode[] CreateTypeCodeMapping() {
     var result = new NumericTypeCode[20];
     result[(int)TypeCode.SByte] = NumericTypeCode.SByte;
     result[(int)TypeCode.Byte] = NumericTypeCode.Byte;
     result[(int)TypeCode.Int16] = NumericTypeCode.Int16;
     result[(int)TypeCode.UInt16] = NumericTypeCode.UInt16;
     result[(int)TypeCode.Int32] = NumericTypeCode.Int32;
     result[(int)TypeCode.UInt32] = NumericTypeCode.UInt32;
     result[(int)TypeCode.Int64] = NumericTypeCode.Int64;
     result[(int)TypeCode.UInt64] = NumericTypeCode.UInt64;
     result[(int)TypeCode.Single] = NumericTypeCode.Single;
     result[(int)TypeCode.Double] = NumericTypeCode.Double;
     result[(int)TypeCode.Decimal] = NumericTypeCode.Decimal;
     return result;
 }