public T[] Deserialize(ref JsonReader <TSymbol> reader) { T[] temp = null; T[] result; try { temp = ArrayPool <T> .Shared.Rent(4); reader.ReadBeginArrayOrThrow(); var count = 0; while (!reader.TryReadIsEndArrayOrValueSeparator(ref count)) // count is already preincremented, as it counts the separators { if (count == temp.Length) { FormatterUtils.GrowArray(ref temp); } temp[count - 1] = ElementFormatter.Deserialize(ref reader); } result = count == 0 ? Array.Empty <T>() : FormatterUtils.CopyArray(temp, count); } finally { if (temp != null) { ArrayPool <T> .Shared.Return(temp); } } return(result); }