/// <summary> /// Initializes a new instance of the <see cref="DocumentEntry"/> class. /// </summary> /// <param name="reader">The reader to read from.</param> /// <param name="arrayEntry">A value indicating whether this is an entry in an array.</param> internal DocumentEntry(JsonTextReader reader, bool arrayEntry) { if (!arrayEntry) { // Not a array entry, so there is a key. _key = (string)reader.Value; reader.Read(); } switch (reader.TokenType) { case JsonToken.StartArray: _value = ReadArray(reader); _valueType = DocumentEntryType.Array; break; case JsonToken.StartObject: _value = ReadDocument(reader); _valueType = DocumentEntryType.Document; break; default: var result = ReadValue(reader); _value = result.Item1; _valueType = result.Item2; break; } }
/// <summary> /// Initializes a new instance of the <see cref="DocumentEntry"/> class. /// </summary> /// <param name="key">The key to use.</param> /// <param name="valueType">The type of the value.</param> /// <param name="value">The value to use.</param> public DocumentEntry(string key, DocumentEntryType valueType, object value) { _key = key; _valueType = valueType; _value = value; }