Method ExtXml.Attr(+ 8 overloads)
Overload
Gets XML attribute value.
If the attribute does not exist, returns null
.
If the attribute value is empty, returns ""
.
public static string Attr(this XElement t, XName name)
Parameters
Returns
Overload(next)
Gets XML attribute value.
If the attribute does not exist, returns defaultValue.
If the attribute value is empty, returns ""
.
public static string Attr(this XElement t, XName name, string defaultValue)
Parameters
Returns
Overload(next)
Gets XML attribute value.
If the attribute does not exist, sets value = null
and returns false
.
public static bool Attr(this XElement t, out string value, XName name)
Parameters
Returns
Overload(next)
Gets attribute value converted to int number. If the attribute does not exist, returns defaultValue. If the attribute value is empty or does not begin with a valid number, returns 0.
public static int Attr(this XElement t, XName name, int defaultValue)
Parameters
Returns
Overload(next)
Gets attribute value converted to int number.
If the attribute does not exist, sets value = 0 and returns false
.
If the attribute value is empty or does not begin with a valid number, sets value = 0 and returns true
.
public static bool Attr(this XElement t, out int value, XName name)
Parameters
Returns
Overload(next)
Gets attribute value converted to long number.
If the attribute does not exist, sets value = 0 and returns false
.
If the attribute value is empty or does not begin with a valid number, sets value = 0 and returns true
.
public static bool Attr(this XElement t, out long value, XName name)
Parameters
Returns
Overload(next)
Gets attribute value converted to double number.
If the attribute does not exist, sets value = 0 and returns false
.
If the attribute value is empty or is not a valid number, sets value = 0 and returns true
.
public static bool Attr(this XElement t, out double value, XName name)
Parameters
Returns
Overload(next)
Gets attribute value converted to float number.
If the attribute does not exist, sets value = 0 and returns false
.
If the attribute value is empty or is not a valid number, sets value = 0 and returns true
.
public static bool Attr(this XElement t, out float value, XName name)
Parameters
Returns
Overload(top)
Gets attribute value as enum type T.
If the attribute does not exist, sets value = default
and returns false
.
If the attribute value is not a valid enum member name, sets value = default and returns true
.
public static bool Attr<T>(this XElement t, out T value, XName name) where T : unmanaged, Enum
Parameters
Returns
Type Parameters
T |