Get Attribute As Unique Id via XmlDictionaryReader - CSharp System.Xml

CSharp examples for System.Xml:XML Attribute

Description

Get Attribute As Unique Id via XmlDictionaryReader

Demo Code

// The .NET Foundation licenses this file to you under the MIT license.
using System.Xml;
using System.Text;

public class Main{
        private static UniqueId GetAttributeAsUniqueId(XmlDictionaryReader reader, string name, string ns)
        {/*from  w w w .j av  a  2s .com*/
            if (!reader.MoveToAttribute(name, ns))
            {
                return null;
            }

            UniqueId id = reader.ReadContentAsUniqueId();
            reader.MoveToElement();

            return id;
        }
        internal static UniqueId GetAttributeAsUniqueId(XmlDictionaryReader reader, XmlDictionaryString localName, XmlDictionaryString ns)
        {
            return GetAttributeAsUniqueId(reader, localName.Value, (ns != null ? ns.Value : null));
        }
}

Related Tutorials