Esempio n. 1
0
        /// <summary>
        /// Gets an <see cref="IEnumerable{T}"/> of <see cref="JProperty"/>
        /// of this object's properties.</summary>
        /// <param name="jcontainer"></param>
        /// <returns></returns>
        static public IEnumerable <JProperty> Properties(this JProperty jcontainer)
        {
            JObject jobject = jcontainer.ValueObjet();

            if (jobject != null)
            {
                return(jobject.Properties());
            }
            else
            {
                return(new JProperty[0]);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Gets the <see cref="JProperty"/> with the specified name. The exact name
        /// will be searched for first and if no matching property is found then the <see cref="StringComparison"/>
        /// will be used to match a property.</summary>
        /// <param name="jcontainer"></param>
        /// <param name="name">The property name</param>
        /// <param name="comparison">One of the enumeration values that specifies how the strings will be compared.</param>
        /// <returns>A <see cref="JProperty"/> matched with the specified name or null.</returns>
        static public JProperty Property(this JProperty jcontainer, string name, StringComparison comparison)
        {
            JObject jobject = jcontainer.ValueObjet();

            if (jobject != null)
            {
                return(jobject.Property(name, comparison));
            }
            else
            {
                return(null);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Add a <see cref="JProperty"/> and return it
 /// </summary>
 /// <param name="jproperty"></param>
 /// <param name="propertyName">Name of the property</param>
 /// <returns>The added property</returns>
 static public JProperty AddProperty(this JProperty jproperty, string propertyName)
 {
     return(jproperty.ValueObjet().AddProperty(propertyName));
 }
Esempio n. 4
0
 /// <summary>
 /// Remove the property with the specified name.
 /// </summary>
 /// <param name="jproperty"></param>
 /// <param name="name">Name of the property</param>
 /// <returns>true if item was successfully removed; otherwise, false.</returns>
 static public bool RemoveProperty(this JProperty jproperty, string name)
 {
     return(jproperty.ValueObjet().Remove(name));
 }