XElementExtensionsGetAttributeValueT Method |
Gets the attribute value of T type of element element given by attributeName.
If no attribute is found or source data are not provided returns defaultValue default value.
Ignores case in attribute name and defined namespace.
Namespace: CMS.HelpersAssembly: CMS.Helpers (in CMS.Helpers.dll) Version: 13.0.131
Syntax public static T GetAttributeValue<T>(
this XElement element,
string attributeName,
T defaultValue
)
Parameters
- element
- Type: System.Xml.LinqXElement
Source XML element - attributeName
- Type: SystemString
Attribute name - defaultValue
- Type: T
Default value
Type Parameters
- T
- Type of return value
Return Value
Type:
TUsage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
XElement. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Remarks This method doesn't work with nullable types such as bool? or int?
See Also