XElementExtensions.GetElementValueAsBoolean method

Version 1.1.28
.NET Framework 4.8
Namespace Skybrud.Essentials.Xml.Extensions
Assembly Skybrud.Essentials.dll

GetElementValueAsBoolean(XElement, string)

Extension method

Gets a boolean value representing the value of the first element matching the specified XPath expression.

public static bool GetElementValueAsBoolean(this XElement element, string expression)

Parameters

element XElement

The parent XElement .

expression String

The XPath expression the element should match.

Returns

An instance of bool representing the element value.

GetElementValueAsBoolean<T>(XElement, string, Func<T, TResult>)

Extension method

Gets an instance of T representing the value of the first element matching the specified XPath expression.

public static T GetElementValueAsBoolean<T>(this XElement element, string expression, Func<T, TResult> callback)

Type Parameters

T

The type the value should be converted to.

Parameters

element XElement

The XElement .

expression String

The XPath expression the element should match.

callback Func<T, TResult>

The callback method used for converting the boolean value.

Returns

T

An instance of T representing the element value.

GetElementValueAsBoolean(XElement, string, IXmlNamespaceResolver)

Extension method

Gets a boolean value representing the value of the first element matching the specified XPath expression.

public static bool GetElementValueAsBoolean(this XElement element, string expression, IXmlNamespaceResolver resolver)

Parameters

element XElement

The XElement .

expression String

The XPath expression the element should match.

An instance of IXmlNamespaceResolver for resolving namespace prefixes in the XPath expression.

Returns

An instance of bool representing the element value.

GetElementValueAsBoolean(XElement, string, IXmlNamespaceResolver, out bool)

Extension method

Gets a boolean value representing the value of the first element matching the specified XPath expression.

public static bool GetElementValueAsBoolean(this XElement element, string expression, IXmlNamespaceResolver resolver, bool value)

Parameters

element XElement

The XElement .

expression String

The XPath expression the element should match.

An instance of IXmlNamespaceResolver for resolving namespace prefixes in the XPath expression.

value bool

An instance of bool representing the element value.

Returns

true if a matching element was found; otherwise false.

GetElementValueAsBoolean<T>(XElement, string, IXmlNamespaceResolver, Func<T, TResult>)

Extension method

Gets an instance of T representing the value of the first element matching the specified XPath expression.

public static T GetElementValueAsBoolean<T>(this XElement element, string expression, IXmlNamespaceResolver resolver, Func<T, TResult> callback)

Type Parameters

T

The type the value should be converted to.

Parameters

element XElement

The XElement .

expression String

The XPath expression the element should match.

An instance of IXmlNamespaceResolver for resolving namespace prefixes in the XPath expression.

callback Func<T, TResult>

The callback method used for converting the boolean value.

Returns

T

An instance of T representing the element value.

GetElementValueAsBoolean(XElement, XName)

Extension method

Gets a boolean value representing the value of the first element matching the specified name.

public static bool GetElementValueAsBoolean(this XElement element, XName name)

Parameters

element XElement

The parent XElement .

name XName

The XName the element should match.

Returns

An instance of bool representing the element value.

GetElementValueAsBoolean(XElement, XName, out bool)

Extension method

Gets a boolean value representing the value of the first element matching the specified name.

public static bool GetElementValueAsBoolean(this XElement element, XName name, bool value)

Parameters

element XElement

The parent XElement .

name XName

The XName the element should match.

value bool

An instance of bool representing the element value.

Returns

true if a matching element was found; otherwise false.

GetElementValueAsBoolean<T>(XElement, XName, Func<T, TResult>)

Extension method

Gets an instance of T representing the value of the first element matching the specified name.

public static T GetElementValueAsBoolean<T>(this XElement element, XName name, Func<T, TResult> callback)

Type Parameters

T

The type the value should be converted to.

Parameters

element XElement

The XElement .

name XName

The XName identifying the element.

callback Func<T, TResult>

The callback method used for converting the boolean value.

Returns

T

An instance of bool representing the element value.