Gets the value of the given XML attribute. - CSharp System.Xml

CSharp examples for System.Xml:XML Attribute

Description

Gets the value of the given XML attribute.

Demo Code

// Permission is hereby granted, free of charge, to any person obtaining
using System.Xml;

public class Main{
        /// <summary>
        /// Gets the value of the given attribute.
        /// </summary>
        /// <param name="result">The result.</param>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public static string GetAttribute(this XmlNode result, string name)
        {//from   w  w  w. jav a  2  s  .c o m
            XmlAttribute attr = result.Attributes[name];

            return attr == null ? null : attr.Value;
        }
}

Related Tutorials