XmlHelper class

Helpers for converting arbitrary objects into XElement instances.

public static class XmlHelper

Public Members

name description
static MaxDepth { get; set; } Maximum recursion depth for object-to-XML conversion. This value can be adjusted if deeper object graphs need to be serialized.
const DefaultMaxDepth Default maximum recursion depth for object-to-XML conversion. Chosen to balance performance and stack safety for typical object graphs. Adjust if deeper object graphs need to be serialized.
static ToHashtable(…) Converts an XElement into a Hashtable. Nested elements become nested Hashtables; repeated elements become lists. Attributes are stored as keys prefixed with “@”, xsi:nil=”true” becomes null.
static ToXml(…) Converts an object to an XElement with the specified name, handling nulls, primitives, dictionaries, enumerables, and complex types.

See Also