I am trying to parse an XML document and store the data in an array using LINQ in C# where I have multiple inner element with different data their attributes with the same name and it looks like 

```
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Catalog>
 <Book ISBN="1.1.1.1" Genre="Thriller">
  <Title  PublishDt="2015-07-09">
   <Pty R="1" ID="Buyer_Company">
   </Pty>
   <Pty R="2" ID="Seller_Company">
   </Pty>
    </Title>
</Book>
</Catalog>

```

I am trying to store all the above data in an array I am not sure how to deal with the element `Pty` where I have to store `Buyer_Company` in `Buy` and `Seller_Company` in `Sell` as they have same Element name and Attribute name ID.

I got the remaining data as follows

```
 var result = doc.Descendants("Book")
        .Select(b => new
        {
            ISBN= b.Attribute("ISBN").Value,
            Genre=b.Attribute("Genre").Value,

            PublishDate= b.Element("Title").Attribute("MMY").Value,        
           Sell=b.Element("Title").Element("Pty").Attribute("ID").Value.Where......
Buy=b.Element("Title").Element("Pty").Attribute("ID").Value.Where......(this is where I have issues)
        })
        .ToArray();

```

**May I know how I can use `WHERE` condition in inner element and attributes of `XML` in `LINQ` in `C#` such R=1 represents Buyer and R=2 represents Seller?**