Class HierarchyExtensions
- Namespace
- Cuemon.Extensions.Xml
- Assembly
- Cuemon.Extensions.Xml.dll
Extension methods for the IHierarchy<T> interface.
public static class HierarchyExtensions
- Inheritance
-
HierarchyExtensions
Methods
GetXmlQualifiedEntity(IHierarchy<object>, XmlQualifiedEntity)
Resolves an XmlQualifiedEntity from either the specified qualifiedEntity or from the IHierarchy{object}.
public static XmlQualifiedEntity GetXmlQualifiedEntity(this IHierarchy<object> hierarchy, XmlQualifiedEntity qualifiedEntity = null)
Parameters
hierarchyIHierarchy<object>The IHierarchy{object} to extend.
qualifiedEntityXmlQualifiedEntityThe optional XmlQualifiedEntity that is part of the equation.
Returns
- XmlQualifiedEntity
An XmlQualifiedEntity that is either from
qualifiedEntity, embedded withinhierarchy, XmlRootAttribute, XmlElementAttribute, XmlAttributeAttribute or resolved from either member name or member type (in that order).
Exceptions
- ArgumentNullException
hierarchycannot be null.
HasXmlIgnoreAttribute(IHierarchy<object>)
Determines whether the hierarchy implements XmlIgnoreAttribute.
public static bool HasXmlIgnoreAttribute(this IHierarchy<object> hierarchy)
Parameters
hierarchyIHierarchy<object>The IHierarchy{object} to extend.
Returns
- bool
trueif the IHierarchy{object} implements XmlIgnoreAttribute; otherwise,false.
Exceptions
- ArgumentNullException
hierarchycannot be null.
IsNodeEnumerable(IHierarchy<object>)
Determines whether the hierarchy implements either IEnumerable or IEnumerable<T> and is not a string.
public static bool IsNodeEnumerable(this IHierarchy<object> hierarchy)
Parameters
hierarchyIHierarchy<object>The IHierarchy{object} to extend.
Returns
- bool
trueif the IHierarchy{object} implements either IEnumerable or IEnumerable<T> and is not a string; otherwise,false.
Exceptions
- ArgumentNullException
hierarchycannot be null.
OrderByXmlAttributes<T>(IEnumerable<IHierarchy<T>>)
Orders a sequence of IHierarchy<T> from hierarchies by nodes having an XmlAttributeAttribute decoration.
public static IEnumerable<IHierarchy<T>> OrderByXmlAttributes<T>(this IEnumerable<IHierarchy<T>> hierarchies)
Parameters
hierarchiesIEnumerable<IHierarchy<T>>The IEnumerable{IHierarchy{object}} to extend.
Returns
- IEnumerable<IHierarchy<T>>
A sequence of IHierarchy<T> that is sorted by nodes having an XmlAttributeAttribute decoration first.
Type Parameters
TThe type of the node represented in the hierarchical structure.
Exceptions
- ArgumentNullException
hierarchiescannot be null.