Click or drag to resize
XmlExtensionsAddAttributes Method
Adds the given list of attributes to the XML node. Adds the attributes in alphabetic order to maintain stability of order.

Namespace: CMS.Helpers
Assembly: CMS.Helpers (in CMS.Helpers.dll) Version: 9.0.0
Syntax
C#
public static void AddAttributes(
	this XmlElement node,
	IDictionary attributes,
	bool removeEmptyEntries = true
)

Parameters

node
Type: System.XmlXmlElement
XML node to add attributes to.
attributes
Type: System.CollectionsIDictionary
Attributes to be added.
removeEmptyEntries (Optional)
Type: SystemBoolean
If true, only attributes with non-empty value are added to the element.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type XmlElement. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentExceptionSome key of attributes is an empty string.
ArgumentNullExceptionnode is null.
InvalidOperationExceptionKeys of attributes cannot be ordered.
XmlExceptionSome key of attributes contains characters not suitable for an XML attribute name.
See Also