Пример #1
0
            internal ObjectEnumerator(JsonElement target)
            {
                _target  = target;
                _curIdx  = -1;
                _current = null;

                if (target._parent is JsonDocument document)
                {
                    Debug.Assert(target.TokenType == JsonTokenType.StartObject);
                    _endIdxOrVersion = document.GetEndIndex(_target._idx, includeEndElement: false);
                }
                else
                {
                    var jsonObject = (JsonObject)target._parent;
                    _endIdxOrVersion = jsonObject._version;
                }
            }
Пример #2
0
 /// <summary>
 ///   Initializes a new instance of the <see cref="JsonObjectEnumerator"/> class supporting an interation over provided JSON object.
 /// </summary>
 /// <param name="jsonObject">JSON object to iterate over.</param>
 public JsonObjectEnumerator(JsonObject jsonObject)
 {
     _first   = jsonObject._first;
     _current = null;
 }