Class XElementExtension
- Namespace
- Loehnert.Utility.Extensions
- Assembly
- Loehnert.Utility.dll
Extensions for the XElement class.
public static class XElementExtension
- Inheritance
-
XElementExtension
- Inherited Members
Methods
GetAttribute(XElement, string)
Gets an attribute of an note by attribute name and throws an FileFormatException when it is not found.
public static string GetAttribute(this XElement note, string attributeName)
Parameters
Returns
- string
Value of the attribute.
Exceptions
- FileFormatException
Thrown when
note
doesn't have the attribute with theattributeName
.- ArgumentNullException
Thrown when
attributeName
is null or empty.
GetPosition(IXmlLineInfo)
Gets a string containing the line and column number.
public static string GetPosition(this IXmlLineInfo lineInfoElement)
Parameters
lineInfoElement
IXmlLineInfo
Returns
- string
A text with line and column number or Empty if HasLineInfo() is false.