XLinqExtensions
Assembly: ServiceStack.Common.dll
View Source
public static class XLinqExtensions
Methods
GetString(XElement, String)
View Source
public static string GetString(this XElement el, string name)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetStringAttributeOrDefault(XElement, String)
View Source
public static string GetStringAttributeOrDefault(this XElement element, string name)
Returns
System.String
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | element |
System.String | name |
GetAttributeValueOrDefault<T>(XAttribute, String, Func<XAttribute, T>)
View Source
public static T GetAttributeValueOrDefault<T>(this XAttribute attr, string name, Func<XAttribute, T> converter)
Returns
<T>
Parameters
Type | Name |
---|---|
System.Xml.Linq.XAttribute | attr |
System.String | name |
System.Func<System.Xml.Linq.XAttribute,<T>> | converter |
Type Parameters
T
GetBool(XElement, String)
View Source
public static bool GetBool(this XElement el, string name)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetBoolOrDefault(XElement, String)
View Source
public static bool GetBoolOrDefault(this XElement el, string name)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetNullableBool(XElement, String)
View Source
public static bool? GetNullableBool(this XElement el, string name)
Returns
System.Nullable<System.Boolean>
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetInt(XElement, String)
View Source
public static int GetInt(this XElement el, string name)
Returns
System.Int32
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetIntOrDefault(XElement, String)
View Source
public static int GetIntOrDefault(this XElement el, string name)
Returns
System.Int32
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetNullableInt(XElement, String)
View Source
public static int? GetNullableInt(this XElement el, string name)
Returns
System.Nullable<System.Int32>
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetLong(XElement, String)
View Source
public static long GetLong(this XElement el, string name)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetLongOrDefault(XElement, String)
View Source
public static long GetLongOrDefault(this XElement el, string name)
Returns
System.Int64
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetNullableLong(XElement, String)
View Source
public static long? GetNullableLong(this XElement el, string name)
Returns
System.Nullable<System.Int64>
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetDecimal(XElement, String)
View Source
public static decimal GetDecimal(this XElement el, string name)
Returns
System.Decimal
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetDecimalOrDefault(XElement, String)
View Source
public static decimal GetDecimalOrDefault(this XElement el, string name)
Returns
System.Decimal
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetNullableDecimal(XElement, String)
View Source
public static decimal? GetNullableDecimal(this XElement el, string name)
Returns
System.Nullable<System.Decimal>
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetDateTime(XElement, String)
View Source
public static DateTime GetDateTime(this XElement el, string name)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetDateTimeOrDefault(XElement, String)
View Source
public static DateTime GetDateTimeOrDefault(this XElement el, string name)
Returns
System.DateTime
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetNullableDateTime(XElement, String)
View Source
public static DateTime? GetNullableDateTime(this XElement el, string name)
Returns
System.Nullable<System.DateTime>
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetTimeSpan(XElement, String)
View Source
public static TimeSpan GetTimeSpan(this XElement el, string name)
Returns
System.TimeSpan
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetTimeSpanOrDefault(XElement, String)
View Source
public static TimeSpan GetTimeSpanOrDefault(this XElement el, string name)
Returns
System.TimeSpan
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetNullableTimeSpan(XElement, String)
View Source
public static TimeSpan? GetNullableTimeSpan(this XElement el, string name)
Returns
System.Nullable<System.TimeSpan>
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetGuid(XElement, String)
View Source
public static Guid GetGuid(this XElement el, string name)
Returns
System.Guid
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetGuidOrDefault(XElement, String)
View Source
public static Guid GetGuidOrDefault(this XElement el, string name)
Returns
System.Guid
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetNullableGuid(XElement, String)
View Source
public static Guid? GetNullableGuid(this XElement el, string name)
Returns
System.Nullable<System.Guid>
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | el |
System.String | name |
GetElementValueOrDefault<T>(XElement, String, Func<XElement, T>)
View Source
public static T GetElementValueOrDefault<T>(this XElement element, string name, Func<XElement, T> converter)
Returns
<T>
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | element |
System.String | name |
System.Func<System.Xml.Linq.XElement,<T>> | converter |
Type Parameters
T
GetElement(XElement, String)
View Source
public static XElement GetElement(this XElement element, string name)
Returns
System.Xml.Linq.XElement
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | element |
System.String | name |
AssertElementHasValue(XElement, String)
View Source
public static void AssertElementHasValue(this XElement element, string name)
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | element |
System.String | name |
GetValues(IEnumerable<XElement>)
View Source
public static List<string> GetValues(this IEnumerable<XElement> els)
Returns
System.Collections.Generic.List<System.String>
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> | els |
AnyAttribute(XElement, String)
View Source
public static XAttribute AnyAttribute(this XElement element, string name)
Returns
System.Xml.Linq.XAttribute
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | element |
System.String | name |
AllElements(XElement, String)
View Source
public static IEnumerable<XElement> AllElements(this XElement element, string name)
Returns
System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement>
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | element |
System.String | name |
AnyElement(XElement, String)
View Source
public static XElement AnyElement(this XElement element, string name)
Returns
System.Xml.Linq.XElement
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | element |
System.String | name |
AnyElement(IEnumerable<XElement>, String)
View Source
public static XElement AnyElement(this IEnumerable<XElement> elements, string name)
Returns
System.Xml.Linq.XElement
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> | elements |
System.String | name |
AllElements(IEnumerable<XElement>, String)
View Source
public static IEnumerable<XElement> AllElements(this IEnumerable<XElement> elements, string name)
Returns
System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement>
Parameters
Type | Name |
---|---|
System.Collections.Generic.IEnumerable<System.Xml.Linq.XElement> | elements |
System.String | name |
FirstElement(XElement)
View Source
public static XElement FirstElement(this XElement element)
Returns
System.Xml.Linq.XElement
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | element |
NextElement(XElement)
View Source
public static XElement NextElement(this XElement element)
Returns
System.Xml.Linq.XElement
Parameters
Type | Name |
---|---|
System.Xml.Linq.XElement | element |