示例#1
0
 /// <inheritdoc/>
 public override bool TryGetElement(int index, out VariantValue value)
 {
     if (index >= 0 && Token is JArray o && index < o.Count)
     {
         value = new JsonVariantValue(o[index], _serializer);
         return(true);
     }
     value = new JsonVariantValue(null, _serializer);
     return(false);
 }
示例#2
0
 /// <inheritdoc/>
 protected override VariantValue AddProperty(string property)
 {
     if (Token is JObject o)
     {
         var child = new JsonVariantValue(null, _serializer);
         // Add to object
         o.Add(property, child.Token);
         return(child);
     }
     throw new NotSupportedException("Not an object");
 }
示例#3
0
 /// <inheritdoc/>
 public override bool TryGetProperty(string key, out VariantValue value,
                                     StringComparison compare)
 {
     if (Token is JObject o)
     {
         var success = o.TryGetValue(key, compare, out var token);
         if (success)
         {
             value = new JsonVariantValue(token, _serializer);
             return(true);
         }
     }
     value = new JsonVariantValue(null, _serializer);
     return(false);
 }