How to get all child elements in the parent element of xml in c#
<p>think this is my xml ..</p>

<pre><code>&lt;ListOfDestinations&gt;
  &lt;Destination&gt;
    &lt;City&gt;Ahmedabad&lt;/City&gt;
    &lt;Title&gt;Cheap Flights to Ahmedabad&lt;/Title&gt;
    &lt;Content&gt;
    &lt;Top10PlacestoVisit&gt;
      &lt;subTitle&gt;1&lt;/subTitle&gt;
      &lt;details&gt;d1&lt;/details&gt;
      &lt;subTitle&gt;2&lt;/subTitle&gt;
      &lt;details&gt;d2&lt;/details&gt;
      &lt;subTitle&gt;3&lt;/subTitle&gt;
      &lt;details&gt;d3&lt;/details&gt;
      &lt;subTitle&gt;4&lt;/subTitle&gt;
      &lt;details&gt;d4&lt;/details&gt;
      &lt;subTitle&gt;5&lt;/subTitle&gt;
      &lt;details&gt;d5&lt;/details&gt;
      &lt;subTitle&gt;6&lt;/subTitle&gt;
      &lt;details&gt;d6&lt;/details&gt;
      &lt;subTitle&gt;7&lt;/subTitle&gt;
      &lt;details&gt;d7&lt;/details&gt;
      &lt;subTitle&gt;8&lt;/subTitle&gt;
      &lt;details&gt;d8&lt;/details&gt;
      &lt;subTitle&gt;9&lt;/subTitle&gt;
      &lt;details&gt;d9&lt;/details&gt;
      &lt;subTitle&gt;10&lt;/subTitle&gt;
      &lt;details&gt;d10&lt;/details&gt;
    &lt;/Top10PlacestoVisit&gt;
    &lt;/Content&gt;
   &lt;/Destination&gt;
 &lt;/ListOfDestinations&gt;
</code></pre>

<p>so I want to get all <code>subTitle</code> and <code>details</code> to a list.how can I do that.This is what I tried.</p>

<pre><code>XmlDocument DestinationXml = new XmlDocument();
DestinationXml.Load(Server.MapPath("~/Xml_Data/Destination.xml"));
var xdoc = XDocument.Parse(DestinationXml.InnerXml);


var selectedCity = xdoc.Descendants("ListOfDestinations")
                        .Select(d =&gt; d.Elements("Destination")
                        .Where(w =&gt; w.Element("City").Value == DesName));
</code></pre>

<p><strong>in this place get all the data(subTitle and details) inside the  <code>&lt;Top10PlacestoVisit&gt;&lt;/Top10PlacestoVisit&gt;</code></strong> </p>

<p>then I created a <code>Model</code> and assigned values like this.but I can't get <code>subTitle</code> and <code>details</code> at once to the list.this is what I tried</p>

<pre><code>foreach (var itemz in selectedCity)
{
    var needed = itemz.Elements("Top10PlacestoVisit");
    foreach (var nitems in needed)
   {
       var getSubs = needed.Elements("details");
       foreach (var itm in getSubs)
       {
           details.Add(new Destinations
          {
               details = itm.Value
         });
       }
  }
}

ViewBag.details = details;
</code></pre>

<p>in here it successfully gets <code>subTitle</code> but how can I get <code>details</code> and assign it in the same time.help me with this.</p>