I have a code like:
jobdetails.group = TM_item.Group_xml.ToString(); //XML
var xDoc = XDocument.Parse(jobdetails.group);
var data = xDoc.Root.Elements().OrderBy(x => (string)x.Attribute("name"));
XML:
<Groups>
      <Group name="Front0">
        <Room_type>Front</Room_type>
        <Dimension>Not available</Dimension>
        <Status>PENDING</Status>
        <Notes>None</Notes>
        <User>r2g</User>
        <Audio_length>00:00:00</Audio_length>
        <Image_count>1</Image_count>
        <Section_count>0</Section_count>
      </Group>
</Groups>
I want to put where condition in xDoc.Root.Elements(),
I tried  xDoc.Root.Elements().OrderBy(x => (string)x.Attribute("name")).Where(x => (string)x.Attribute("User").Value == loggedin_user); but it doesnot give me output..I am getting Object reference not set to an instance of an object.
any suggestion?
 
     
     
     
    