XElementExtensions.GetElementValueAsInt32 method
Namespace | Skybrud.Essentials.Xml.Extensions |
---|---|
Assembly | Skybrud.Essentials.dll |
GetElementValueAsInt32<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 GetElementValueAsInt32<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 integer value.
Returns
T
An instance of T
representing the element value.
GetElementValueAsInt32(XElement, string, IXmlNamespaceResolver)
Gets an integer value representing the value of the first element matching the specified XPath
expression
.
public static int GetElementValueAsInt32(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.
GetElementValueAsInt32(XElement, string, IXmlNamespaceResolver, out int)
Gets an integer value representing the value of the first element matching the specified XPath
expression
.
public static bool GetElementValueAsInt32(this XElement element, string expression, IXmlNamespaceResolver resolver, int 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
.
GetElementValueAsInt32<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 GetElementValueAsInt32<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 integer value.
Returns
T
An instance of T
representing the element value.
GetElementValueAsInt32(XElement, XName)
Gets an integer value representing the value of the first element matching the specified
name
.
public static int GetElementValueAsInt32(this XElement element, XName name)
GetElementValueAsInt32(XElement, XName, out int)
Gets an integer value representing the value of the first element matching the specified
name
.
public static bool GetElementValueAsInt32(this XElement element, XName name, int value)
Parameters
Returns
true
if a matching element was found; otherwise false
.
GetElementValueAsInt32<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 GetElementValueAsInt32<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 integer value.
Returns
T
An instance of T
representing the element value.
GetElementValueAsInt32(XElement, string)
Gets an integer value representing the value of the first element matching the specified XPath
expression
.
public static int GetElementValueAsInt32(this XElement element, string expression)
Parameters
expression
String
The XPath expression the element should match.