I have xml which contains nodes. I would like to count the distinct values for that particular node and store into a variable in C#.
My XML is like this
<?xml version="1.0" encoding="utf-8"?>
<Emp>
<A.EMPLID>1</A.EMPLID>
<A.Phone>1234</A.Phone>
</Emp>
<Emp>
<A.EMPLID>2</A.EMPLID>
<A.Phone>1234</A.Phone>
</Emp>
<Emp>
<A.EMPLID>1</A.EMPLID>
<A.Phone>1234</A.Phone>
</Emp>
<Emp>
<A.EMPLID>3</A.EMPLID>
</Emp>
I am trying this C# but throwing an error
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load("SAMPLE.xml");
XmlNodeList count = xmlDoc.SelectNodes(@"//Emp");
Not sure how to Count distinct Emplid. In tis case It will be '3'