CSharp examples for System.Xml:XML Attribute
Get XML Attribute Value
using System.Xml; using System.Linq; using System;/*from w w w. j a v a 2s. co m*/ public class Main{ public static string GetAttributeValue(this XmlElement @this, string attributeName) { var result = @this.Attributes .Cast<XmlAttribute>() .FirstOrDefault(x => x.Name.Equals(attributeName, StringComparison.OrdinalIgnoreCase)); return result == null ? null : result.Value; } }