XElementExtensions.GetElementValueAsBoolean method
Namespace | Skybrud.Essentials.Xml.Extensions |
---|---|
Assembly | Skybrud.Essentials.dll |
GetElementValueAsBoolean(XElement, string)
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
expression
String
The XPath expression the element should match.
GetElementValueAsBoolean<T>(XElement, string, Func<T, TResult>)
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
expression
String
The XPath expression the element should match.
The callback method used for converting the boolean value.
Returns
T
An instance of T
representing the element value.
GetElementValueAsBoolean(XElement, string, IXmlNamespaceResolver)
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
expression
String
The XPath expression the element should match.
resolver
IXmlNamespaceResolver
An instance of IXmlNamespaceResolver for resolving namespace prefixes in the XPath expression.
GetElementValueAsBoolean(XElement, string, IXmlNamespaceResolver, out bool)
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
expression
String
The XPath expression the element should match.
resolver
IXmlNamespaceResolver
An instance of IXmlNamespaceResolver for resolving namespace prefixes in the XPath expression.
Returns
true
if a matching element was found; otherwise false
.
GetElementValueAsBoolean<T>(XElement, string, IXmlNamespaceResolver, Func<T, TResult>)
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
expression
String
The XPath expression the element should match.
resolver
IXmlNamespaceResolver
An instance of IXmlNamespaceResolver for resolving namespace prefixes in the XPath expression.
The callback method used for converting the boolean value.
Returns
T
An instance of T
representing the element value.
GetElementValueAsBoolean(XElement, XName)
Gets a boolean value representing the value of the first element matching the specified
name
.
public static bool GetElementValueAsBoolean(this XElement element, XName name)
GetElementValueAsBoolean(XElement, XName, out bool)
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
Returns
true
if a matching element was found; otherwise false
.
GetElementValueAsBoolean<T>(XElement, XName, Func<T, TResult>)
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
The callback method used for converting the boolean value.
Returns
T
An instance of bool representing the element value.