erminas.SmartAPI.Utils.XmlUtil.AddAttribute C# (CSharp) Method

AddAttribute() public static method

Creates an attribute via the owner document of xmlElement , sets its value and appends it to .
public static AddAttribute ( this xmlElement, string attributeName, string value ) : void
xmlElement this The node, the attribute gets added to
attributeName string Name of the attribute
value string Value of the attribute
return void
        public static void AddAttribute(this XmlElement xmlElement, string attributeName, string value)
        {
            XmlAttribute attr = xmlElement.OwnerDocument.CreateAttribute(attributeName);
            attr.Value = value;
            xmlElement.Attributes.Append(attr);
        }