Пример #1
0
        private static /*dynamic[]*/ JsonArray HydrateArray(JsonReader reader)
        {
            if (reader.Type != JsonType.Array)
            {
                throw new ArgumentException($"unexpected {nameof(reader)}.Type");
            }

            //var result = new List<dynamic>();
            var result = new JsonArray();

            while (reader.Read() && reader.Type != JsonType.Closed)
            {
                dynamic item = HydrateValue(reader);

                result.AddItem(item);
            }

            if (reader.Type != JsonType.Closed)
            {
                throw new JsonException("Array not closed?");
            }

            //return result.ToArray(); // make it a true array
            return(result);
        }