Ejemplo n.º 1
0
        private static bool FromNullableNumericTypeToString(object numericVal, Type oType, CastingContext context, out object result)
        {
            var valueUpdated = true;

            result = null;

            if (oType == TypeClass.Int16NullableClass)
            {
                result = StringConv.Int16ToString(NumericConv.ObjectToNullableInt16(numericVal), string.Empty);
            }
            else if (oType == TypeClass.UInt16NullableClass)
            {
                result = StringConv.UInt16ToString(NumericConv.ObjectToNullableUInt16(numericVal), string.Empty);
            }
            else if (oType == TypeClass.Int32NullableClass)
            {
                result = StringConv.Int32ToString(NumericConv.ObjectToNullableInt32(numericVal), string.Empty);
            }
            else if (oType == TypeClass.UInt32NullableClass)
            {
                result = StringConv.UInt32ToString(NumericConv.ObjectToNullableUInt32(numericVal), string.Empty);
            }
            else if (oType == TypeClass.Int64NullableClass)
            {
                result = StringConv.Int64ToString(NumericConv.ObjectToNullableInt64(numericVal), string.Empty);
            }
            else if (oType == TypeClass.UInt64NullableClass)
            {
                result = StringConv.UInt64ToString(NumericConv.ObjectToNullableUInt64(numericVal), string.Empty);
            }
            else if (oType == TypeClass.FloatNullableClass)
            {
                result = StringConv.FloatToString(NumericConv.ObjectToNullableFloat(numericVal), context.Digits);
            }
            else if (oType == TypeClass.DoubleNullableClass)
            {
                result = StringConv.DoubleToString(NumericConv.ObjectToNullableDouble(numericVal), context.Digits);
            }
            else if (oType == TypeClass.DecimalNullableClass)
            {
                result = StringConv.DecimalToString(NumericConv.ObjectToNullableDecimal(numericVal), context.Digits, string.Empty);
            }
            else
            {
                valueUpdated = false;
            }

            return(valueUpdated);
        }