Raj Kumar

Raj Kumar

  • Tech Writer
  • 47.3k
  • 27.9m

How to get XML LastChild attribute value in silverlight

Oct 28 2010 6:37 AM
This is my xml..

<Users>  
  <User UserId="1" Email="[email protected]" Password="rajk" FirstName="raj" LastName="kumar" />
  <User UserId="2" Email="[email protected]" Password="1234" FirstName="raj" LastName="beniwal" />
  <User UserId="3" Email="[email protected]" Password="2222" FirstName="david" LastName="sann" />
</Users>

i wanna fetch UseId 3 on page...i tried this code but it's not working.

    XDocument xmlDoc = XDocument.Load(xmlfile);
            int i = 0;
            i = xmlDoc.ChildNodes(0).LastChild.Attributes("UserId").Value;

ANyone has idea??

Answers (2)