AcTools.Utils.Helpers.JsonDeserializationExtension.ReadLongArray C# (CSharp) Method

ReadLongArray() public static method

public static ReadLongArray ( this reader, int approximateSize = 10 ) : long[]
reader this
approximateSize int
return long[]
        public static long[] ReadLongArray(this JsonTextReader reader, int approximateSize = 10) {
            if (reader.TokenType != JsonToken.StartArray) {
                throw new Exception("StartArray expected");
            }

            var result = new List<long>(approximateSize);
            while (reader.Until(JsonToken.EndArray)) {
                if (reader.Value == null) throw new Exception("Value expected");
                result.Add(long.Parse(reader.Value.ToString(), CultureInfo.InvariantCulture));
            }

            return result.ToArray();
        }
    }