title: XElement Iteration and adding it to parent
body: <p>hi I have the following question ...please do help as I am very new to programming in C# with no previous  programming experience...</p>
  
  <p>In my code I am suppose to Iterate through XElement in a Xml file add that Xelement to a parent known as Capability....This is my code...</p>
  
  <pre><code>if (xElem.HasElements)
          {
  
              foreach (XElement xChild in xElem.Element("Elements"))
              {
                  Capability capChild = Parse(xChild);
                  capParent.Children.Add(capChild);
              }
          }
  </code></pre>
  
  <p>here the foreach loop gives an error</p>
  
  <blockquote>
    <p>Error    32  foreach statement cannot operate on variables of type 'System.Xml.Linq.XElement' because 'System.Xml.Linq.XElement' does not contain a public definition for 'GetEnumerator'........</p>
  </blockquote>
  
  <p>how can I carry out the functionality of finding if XElement has any child and adding it to the parent Capability?  </p>