How do we access attributes using "XmlReader"?
The below snippets represents the way to access attributes. At First in order to check whether there any attributes present in the current node you can use "HasAttributes" function and use the "MoveToNextAttribute" method to move forward in attribute. Just in case you want to move to the next element use "MoveToElement()".
if (reader.HasAttributes)
{
while(reader.MoveToNextAttribute())
{
// your logic goes here
string pdata = reader.Value
}
}
reader.MoveToElement();