예제 #1
0
        public static float GetFloat(int i)
        {
            var type = reader.GetFieldType(i);

            if (type == typeof(double))
            {
                return (float)reader.GetDouble(i);
            }

            if (type == typeof(float))
            {
                return reader.GetFloat(i);
            }

            if (type == typeof(int))
            {
                return reader.GetInt32(i);
            }

            if (float.TryParse(reader.GetValue(i)?.ToString(), out float value))
            {
                return value;
            }

            throw Exception("Can't parse number from column " + (i + 1));
        }
예제 #2
0
 public float GetFloat(int i) => _reader.GetFloat(i);