XElementExtensions.GetAttributeValueAsInt32 method

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

GetAttributeValueAsInt32(XElement, XName)

Extension method

Gets an instance of int representing the value of the attribute matching the specified name. If a matching attribute ins't found, the default value of int will be returned instead.

public static int GetAttributeValueAsInt32(this XElement element, XName name)

Parameters

element XElement

The parent XElement .

name XName

An instance of XName identifying the attribute.

Returns

int

An instance of int representing the attribute value, or the default value of int if a matching attribute wasn't found.

GetAttributeValueAsInt32(XElement, XName, out int)

Extension method

Gets an instance of int representing the value of the attribute matching the specified name. If a matching attribute ins't found, the default value of int will be returned instead.

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

Parameters

element XElement

The XElement .

name XName

An instance of XName identifying the attribute.

value int

An instance of int representing the element value.

Returns

true if a matching element was found; otherwise false.

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

Extension method

Gets an instance of T representing the value of the attribute matching the specified name. If a matching attribute ins't found, the default value of T will be returned instead.

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

Type Parameters

T

Parameters

element XElement

The parent XElement .

name XName

An instance of XName identifying the attribute.

callback Func<T, TResult>

The callback method used for converting the attribute value.

Returns

T

An instance of T representing the attribute value, or the default value of T if a matching attribute wasn't found.

GetAttributeValueAsInt32(XElement, string)

Extension method

Gets an instance of int representing the value of the attribute matching the specified XPath expression. If a matching attribute ins't found, the default value of int will be returned instead.

public static int GetAttributeValueAsInt32(this XElement element, string expression)

Parameters

element XElement

The parent XElement .

expression String

The XPath expression the attribute should match.

Returns

int

An instance of int representing the attribute value, or the default value of int if a matching attribute wasn't found.

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

Extension method

Gets an instance of T representing the value of the attribute matching the specified XPath expression. If a matching attribute ins't found found, the default value of T will be returned instead.

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

Type Parameters

T

Parameters

element XElement

The parent XElement .

expression String

The XPath expression the attribute should match.

callback Func<T, TResult>

The callback method used for converting the attribute value.

Returns

T

An instance of T representing the attribute value, or the default value of T if a matching attribute wasn't found.

GetAttributeValueAsInt32(XElement, string, IXmlNamespaceResolver)

Extension method

Gets an instance of int representing the value of the attribute matching the specified XPath expression. If a matching attribute ins't found, the default value of int will be returned instead.

public static int GetAttributeValueAsInt32(this XElement element, string expression, IXmlNamespaceResolver resolver)

Parameters

element XElement

The parent XElement .

expression String

The XPath expression the attribute should match.

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

Returns

int

An instance of int representing the attribute value, or the default value of int if a matching attribute wasn't found.

GetAttributeValueAsInt32(XElement, string, out int)

Extension method

Gets an instance of int representing the value of the attribute matching the specified XPath expression. If a matching attribute ins't found, the default value of int will be returned instead.

public static bool GetAttributeValueAsInt32(this XElement element, string expression, int value)

Parameters

element XElement

The XElement .

expression String

The XPath expression the attribute should match.

value int

An instance of int representing the element value.

Returns

true if a matching element was found; otherwise false.

GetAttributeValueAsInt32(XElement, string, IXmlNamespaceResolver, out int)

Extension method

Gets an instance of int representing the value of the attribute matching the specified XPath expression. If a matching attribute ins't found, the default value of int will be returned instead.

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

Parameters

element XElement

The XElement .

expression String

The XPath expression the attribute should match.

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

value int

An instance of int representing the element value.

Returns

true if a matching element was found; otherwise false.

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

Extension method

Gets an instance of T representing the value of the attribute matching the specified XPath expression. If a matching attribute ins't found found, the default value of T will be returned instead.

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

Type Parameters

T

Parameters

element XElement

The parent XElement .

expression String

The XPath expression the attribute 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 attribute value.

Returns

T

An instance of T representing the attribute value, or the default value of T if a matching attribute wasn't found.