public static ReadIntArray ( this reader, int approximateSize = 10 ) : int[] | ||
reader | this | |
approximateSize | int | |
return | int[] |
public static int[] ReadIntArray(this JsonTextReader reader, int approximateSize = 10) {
if (reader.TokenType != JsonToken.StartArray) {
throw new Exception("StartArray expected");
}
var result = new List<int>(approximateSize);
while (reader.Until(JsonToken.EndArray)) {
if (reader.Value == null) throw new Exception("Value expected");
result.Add(int.Parse(reader.Value.ToString(), CultureInfo.InvariantCulture));
}
return result.ToArray();
}