示例#1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JProperty"/> class from another <see cref="JProperty"/> object.
 /// </summary>
 /// <param name="other">A <see cref="JProperty"/> object to copy from.</param>
 public JProperty(JProperty other)
   : base(other)
 {
   _name = other.Name;
 }
示例#2
0
    /// <summary>
    /// Loads an <see cref="JProperty"/> from a <see cref="JsonReader"/>. 
    /// </summary>
    /// <param name="reader">A <see cref="JsonReader"/> that will be read for the content of the <see cref="JProperty"/>.</param>
    /// <returns>A <see cref="JProperty"/> that contains the JSON that was read from the specified <see cref="JsonReader"/>.</returns>
    public static new JProperty Load(JsonReader reader)
    {
      if (reader.TokenType == JsonToken.None)
      {
        if (!reader.Read())
          throw JsonReaderException.Create(reader, "Error reading JProperty from JsonReader.");
      }

      while (reader.TokenType == JsonToken.Comment)
      {
        reader.Read();
      }

      if (reader.TokenType != JsonToken.PropertyName)
        throw JsonReaderException.Create(reader, "Error reading JProperty from JsonReader. Current JsonReader item is not a property: {0}".FormatWith(CultureInfo.InvariantCulture, reader.TokenType));

      JProperty p = new JProperty((string)reader.Value);
      p.SetLineInfo(reader as IJsonLineInfo);

      p.ReadTokenFrom(reader);

      return p;
    }
示例#3
0
    public void ITypedListGetItemProperties()
    {
      JProperty p1 = new JProperty("Test1", 1);
      JProperty p2 = new JProperty("Test2", "Two");
      ITypedList a = new JArray(new JObject(p1, p2));

      PropertyDescriptorCollection propertyDescriptors = a.GetItemProperties(null);
      Assert.IsNotNull(propertyDescriptors);
      Assert.AreEqual(2, propertyDescriptors.Count);
      Assert.AreEqual("Test1", propertyDescriptors[0].Name);
      Assert.AreEqual("Test2", propertyDescriptors[1].Name);
    }
示例#4
0
        internal override bool DeepEquals(JToken node)
        {
            JProperty t = node as JProperty;

            return(t != null && _name == t.Name && ContentsEqual(t));
        }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JProperty"/> class from another <see cref="JProperty"/> object.
 /// </summary>
 /// <param name="other">A <see cref="JProperty"/> object to copy from.</param>
 public JProperty(JProperty other)
     : base(other)
 {
     _name = other.Name;
 }
示例#6
0
        internal void InternalPropertyChanging(JProperty childProperty)
        {
#if !(SILVERLIGHT || NET20 || NETFX_CORE || PORTABLE40 || PORTABLE)
            OnPropertyChanging(childProperty.Name);
#endif
        }