private static bool FromObjToNullableNumericType(object fromObj, Type innerType, out object result) { var valueUpdated = true; result = null; if (innerType == TypeClass.ByteClazz) { result = NumConvX.ObjectToNullableByte(fromObj); } else if (innerType == TypeClass.SByteClazz) { result = NumConvX.ObjectToNullableSByte(fromObj); } else if (innerType == TypeClass.Int16Clazz) { result = NumConvX.ObjectToNullableInt16(fromObj); } else if (innerType == TypeClass.UInt16Clazz) { result = NumConvX.ObjectToNullableInt16(fromObj); } else if (innerType == TypeClass.Int32Clazz) { result = NumConvX.ObjectToNullableInt32(fromObj); } else if (innerType == TypeClass.UInt32Clazz) { result = NumConvX.ObjectToNullableUInt32(fromObj); } else if (innerType == TypeClass.Int64Clazz) { result = NumConvX.ObjectToNullableInt64(fromObj); } else if (innerType == TypeClass.UInt64Clazz) { result = NumConvX.ObjectToNullableUInt64(fromObj); } else if (innerType == TypeClass.FloatClazz) { result = NumConvX.ObjectToNullableFloat(fromObj); } else if (innerType == TypeClass.DoubleClazz) { result = NumConvX.ObjectToNullableDouble(fromObj); } else if (innerType == TypeClass.DecimalClazz) { result = NumConvX.ObjectToNullableDecimal(fromObj); } else { valueUpdated = false; } return(valueUpdated); }
private static bool FromNullableNumericTypeToString(object numericVal, Type oType, CastingContext context, out object result) { var valueUpdated = true; result = null; if (oType == TypeClass.Int16NullableClazz) { result = StrConvX.Int16ToString(NumConvX.ObjectToNullableInt16(numericVal), context.NumericConvOptions, string.Empty); } else if (oType == TypeClass.UInt16NullableClazz) { result = StrConvX.UInt16ToString(NumConvX.ObjectToNullableUInt16(numericVal), context.NumericConvOptions, string.Empty); } else if (oType == TypeClass.Int32NullableClazz) { result = StrConvX.Int32ToString(NumConvX.ObjectToNullableInt32(numericVal), context.NumericConvOptions, string.Empty); } else if (oType == TypeClass.UInt32NullableClazz) { result = StrConvX.UInt32ToString(NumConvX.ObjectToNullableUInt32(numericVal), context.NumericConvOptions, string.Empty); } else if (oType == TypeClass.Int64NullableClazz) { result = StrConvX.Int64ToString(NumConvX.ObjectToNullableInt64(numericVal), context.NumericConvOptions, string.Empty); } else if (oType == TypeClass.UInt64NullableClazz) { result = StrConvX.UInt64ToString(NumConvX.ObjectToNullableUInt64(numericVal), context.NumericConvOptions, string.Empty); } else if (oType == TypeClass.FloatNullableClazz) { result = StrConvX.FloatToString(NumConvX.ObjectToNullableFloat(numericVal), context.Digits, context.NumericConvOptions); } else if (oType == TypeClass.DoubleNullableClazz) { result = StrConvX.DoubleToString(NumConvX.ObjectToNullableDouble(numericVal), context.Digits, context.NumericConvOptions); } else if (oType == TypeClass.DecimalNullableClazz) { result = StrConvX.DecimalToString(NumConvX.ObjectToNullableDecimal(numericVal), context.Digits, context.NumericConvOptions, string.Empty); } else { valueUpdated = false; } return(valueUpdated); }