Skip to main content

XLinqExtensions

Assembly: ServiceStack.Common.dll​
View Source​
Declaration
public static class XLinqExtensions

Methods​

GetString(XElement, String)​

View Source​
Declaration
public static string GetString(this XElement el, string name)
Returns​

System.String

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetStringAttributeOrDefault(XElement, String)​

View Source​
Declaration
public static string GetStringAttributeOrDefault(this XElement element, string name)
Returns​

System.String

Parameters​
TypeName
System.Xml.Linq.XElementelement
System.Stringname

GetAttributeValueOrDefault<T>(XAttribute, String, Func<XAttribute, T>)​

View Source​
Declaration
public static T GetAttributeValueOrDefault<T>(this XAttribute attr, string name, Func<XAttribute, T> converter)
Returns​

<T>

Parameters​
TypeName
System.Xml.Linq.XAttributeattr
System.Stringname
System.Func<System.Xml.Linq.XAttribute,<T>>converter
Type Parameters​
  • T

GetBool(XElement, String)​

View Source​
Declaration
public static bool GetBool(this XElement el, string name)
Returns​

System.Boolean

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetBoolOrDefault(XElement, String)​

View Source​
Declaration
public static bool GetBoolOrDefault(this XElement el, string name)
Returns​

System.Boolean

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetNullableBool(XElement, String)​

View Source​
Declaration
public static bool? GetNullableBool(this XElement el, string name)
Returns​

System.Nullable<System.Boolean>

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetInt(XElement, String)​

View Source​
Declaration
public static int GetInt(this XElement el, string name)
Returns​

System.Int32

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetIntOrDefault(XElement, String)​

View Source​
Declaration
public static int GetIntOrDefault(this XElement el, string name)
Returns​

System.Int32

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetNullableInt(XElement, String)​

View Source​
Declaration
public static int? GetNullableInt(this XElement el, string name)
Returns​

System.Nullable<System.Int32>

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetLong(XElement, String)​

View Source​
Declaration
public static long GetLong(this XElement el, string name)
Returns​

System.Int64

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetLongOrDefault(XElement, String)​

View Source​
Declaration
public static long GetLongOrDefault(this XElement el, string name)
Returns​

System.Int64

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetNullableLong(XElement, String)​

View Source​
Declaration
public static long? GetNullableLong(this XElement el, string name)
Returns​

System.Nullable<System.Int64>

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetDecimal(XElement, String)​

View Source​
Declaration
public static decimal GetDecimal(this XElement el, string name)
Returns​

System.Decimal

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetDecimalOrDefault(XElement, String)​

View Source​
Declaration
public static decimal GetDecimalOrDefault(this XElement el, string name)
Returns​

System.Decimal

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetNullableDecimal(XElement, String)​

View Source​
Declaration
public static decimal? GetNullableDecimal(this XElement el, string name)
Returns​

System.Nullable<System.Decimal>

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetDateTime(XElement, String)​

View Source​
Declaration
public static DateTime GetDateTime(this XElement el, string name)
Returns​

System.DateTime

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetDateTimeOrDefault(XElement, String)​

View Source​
Declaration
public static DateTime GetDateTimeOrDefault(this XElement el, string name)
Returns​

System.DateTime

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetNullableDateTime(XElement, String)​

View Source​
Declaration
public static DateTime? GetNullableDateTime(this XElement el, string name)
Returns​

System.Nullable<System.DateTime>

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetTimeSpan(XElement, String)​

View Source​
Declaration
public static TimeSpan GetTimeSpan(this XElement el, string name)
Returns​

System.TimeSpan

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetTimeSpanOrDefault(XElement, String)​

View Source​
Declaration
public static TimeSpan GetTimeSpanOrDefault(this XElement el, string name)
Returns​

System.TimeSpan

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetNullableTimeSpan(XElement, String)​

View Source​
Declaration
public static TimeSpan? GetNullableTimeSpan(this XElement el, string name)
Returns​

System.Nullable<System.TimeSpan>

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetGuid(XElement, String)​

View Source​
Declaration
public static Guid GetGuid(this XElement el, string name)
Returns​

System.Guid

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetGuidOrDefault(XElement, String)​

View Source​
Declaration
public static Guid GetGuidOrDefault(this XElement el, string name)
Returns​

System.Guid

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetNullableGuid(XElement, String)​

View Source​
Declaration
public static Guid? GetNullableGuid(this XElement el, string name)
Returns​

System.Nullable<System.Guid>

Parameters​
TypeName
System.Xml.Linq.XElementel
System.Stringname

GetElementValueOrDefault<T>(XElement, String, Func<XElement, T>)​

View Source​
Declaration
public static T GetElementValueOrDefault<T>(this XElement element, string name, Func<XElement, T> converter)
Returns​

<T>

Parameters​
TypeName
System.Xml.Linq.XElementelement
System.Stringname
System.Func<System.Xml.Linq.XElement,<T>>converter
Type Parameters​
  • T

GetElement(XElement, String)​

View Source​
Declaration
public static XElement GetElement(this XElement element, string name)
Returns​

System.Xml.Linq.XElement

Parameters​
TypeName
System.Xml.Linq.XElementelement
System.Stringname

AssertElementHasValue(XElement, String)​

View Source​
Declaration
public static void AssertElementHasValue(this XElement element, string name)
Parameters​
TypeName
System.Xml.Linq.XElementelement
System.Stringname

GetValues(IEnumerable<XElement>)​

View Source​
Declaration
public static List<string> GetValues(this IEnumerable<XElement> els)
Returns​

System.Collections.Generic.List<System.String>

Parameters​
TypeName
System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement>els

AnyAttribute(XElement, String)​

View Source​
Declaration
public static XAttribute AnyAttribute(this XElement element, string name)
Returns​

System.Xml.Linq.XAttribute

Parameters​
TypeName
System.Xml.Linq.XElementelement
System.Stringname

AllElements(XElement, String)​

View Source​
Declaration
public static IEnumerable<XElement> AllElements(this XElement element, string name)
Returns​

System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement>

Parameters​
TypeName
System.Xml.Linq.XElementelement
System.Stringname

AnyElement(XElement, String)​

View Source​
Declaration
public static XElement AnyElement(this XElement element, string name)
Returns​

System.Xml.Linq.XElement

Parameters​
TypeName
System.Xml.Linq.XElementelement
System.Stringname

AnyElement(IEnumerable<XElement>, String)​

View Source​
Declaration
public static XElement AnyElement(this IEnumerable<XElement> elements, string name)
Returns​

System.Xml.Linq.XElement

Parameters​
TypeName
System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement>elements
System.Stringname

AllElements(IEnumerable<XElement>, String)​

View Source​
Declaration
public static IEnumerable<XElement> AllElements(this IEnumerable<XElement> elements, string name)
Returns​

System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement>

Parameters​
TypeName
System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement>elements
System.Stringname

FirstElement(XElement)​

View Source​
Declaration
public static XElement FirstElement(this XElement element)
Returns​

System.Xml.Linq.XElement

Parameters​
TypeName
System.Xml.Linq.XElementelement

NextElement(XElement)​

View Source​
Declaration
public static XElement NextElement(this XElement element)
Returns​

System.Xml.Linq.XElement

Parameters​
TypeName
System.Xml.Linq.XElementelement