Exemplo n.º 1
0
 /// <summary>
 /// Sets an attribute value. This is chainable.
 /// </summary>
 /// <typeparam name="T">The type of the value.</typeparam>
 /// <param name="el">The element.</param>
 /// <param name="name">The attribute name.</param>
 /// <param name="value">The value to set.</param>
 /// <returns>Itself</returns>
 public static XElement Attr <T>(this XElement el, string name, T value)
 {
     el.SetAttributeValue(name, InfosetHelper.ThrowIfContainsInvalidXmlCharacter(ToString(value)));
     return(el);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Sets the value of an element.
 /// </summary>
 /// <typeparam name="TValue">The type of the value to set.</typeparam>
 /// <param name="el">The element.</param>
 /// <param name="value">The value.</param>
 /// <returns>The element.</returns>
 public static XElement Val <TValue>(this XElement el, TValue value)
 {
     el.SetValue(InfosetHelper.ThrowIfContainsInvalidXmlCharacter(ToString(value)));
     return(el);
 }