예제 #1
0
        public short GetInt16(string name)
        {
            Type   foundType;
            object value = GetElement(name, out foundType) !;

            return(ReferenceEquals(foundType, typeof(short)) ? (short)value : _converter.ToInt16(value));
        }
예제 #2
0
        public short GetInt16(string name)
        {
#if NOT_PFX
            object value = GetValue(name, typeof(System.Int16));
            return(converter.ToInt16(value));
#else
            throw new NotSupportedException();
#endif
        }
예제 #3
0
        public short GetInt16(String name)
        {
            Type   foundType;
            Object value;

            value = GetElement(name, out foundType);
            if (Object.ReferenceEquals(foundType, typeof(short)))
            {
                return((short)value);
            }
            return(m_converter.ToInt16(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 short GetInt16(string name)
        {
            object value = GetValue(name, typeof(System.Int16));

            return(converter.ToInt16(value));
        }
        public short GetInt16(string name)
        {
            var value = GetValue(name, typeof(short));

            return(converter.ToInt16(value));
        }