Пример #1
0
        public decimal GetDecimal(string name)
        {
            Type   foundType;
            object value = GetElement(name, out foundType) !;

            return(ReferenceEquals(foundType, typeof(decimal)) ? (decimal)value : _converter.ToDecimal(value));
        }
Пример #2
0
        public Decimal GetDecimal(string name)
        {
#if NOT_PFX
            object value = GetValue(name, typeof(System.Decimal));
            return(converter.ToDecimal(value));
#else
            throw new NotSupportedException();
#endif
        }
Пример #3
0
        public decimal GetDecimal(String name)
        {
            Type   foundType;
            Object value;

            value = GetElement(name, out foundType);
            if (Object.ReferenceEquals(foundType, typeof(decimal)))
            {
                return((decimal)value);
            }
            return(m_converter.ToDecimal(value));
        }
 internal static object Convert(IFormatterConverter formatterConverter, object value, TypeCode typeCode)
 {
     return(typeCode switch
     {
         TypeCode.Boolean => formatterConverter.ToBoolean(value),
         TypeCode.Byte => formatterConverter.ToBoolean(value),
         TypeCode.Char => formatterConverter.ToChar(value),
         TypeCode.DateTime => formatterConverter.ToDateTime(value),
         TypeCode.Decimal => formatterConverter.ToDecimal(value),
         TypeCode.Double => formatterConverter.ToDouble(value),
         TypeCode.Int16 => formatterConverter.ToInt16(value),
         TypeCode.Int32 => formatterConverter.ToInt32(value),
         TypeCode.Int64 => formatterConverter.ToInt64(value),
         TypeCode.SByte => formatterConverter.ToSByte(value),
         TypeCode.Single => formatterConverter.ToSingle(value),
         TypeCode.String => formatterConverter.ToString(value),
         TypeCode.UInt16 => formatterConverter.ToUInt16(value),
         TypeCode.UInt32 => formatterConverter.ToUInt32(value),
         TypeCode.UInt64 => formatterConverter.ToUInt64(value),
         _ => throw new NotSupportedException("Unsupported type code: " + typeCode),
     });
Пример #5
0
        public Decimal GetDecimal(string name)
        {
            object value = GetValue(name, typeof(System.Decimal));

            return(converter.ToDecimal(value));
        }
Пример #6
0
 public decimal ToDecimal(object value)
 {
     return(_impl.ToDecimal(value));
 }
        public decimal GetDecimal(string name)
        {
            var value = GetValue(name, typeof(decimal));

            return(converter.ToDecimal(value));
        }