title: The type of the expression in the select clause is incorrect. Type inference failed in the call to 'Select'
body: <p>I am learning LINQ and was trying out this example related to <code>select</code> clause.</p>
  
  <pre><code>var q = from c in xmlDoc.Descendants("site").Where(tech =&gt; tech.Attribute("technical").Value == "true")
                     .Select(n =&gt; new { SiteName = n.Element("name").Value});
  </code></pre>
  
  <p>The above query is giving me an error:<br/>
  <code>The type of the expression in the select clause is incorrect. Type inference failed in the call to 'Select'.</code></p>
  
  <p>What is wrong int the above syntax?</p>
  
  <p>Apart from the above, I have to convert the <code>selected</code> options <code>ToDictionary</code>. How can be done in the same query via LINQ?</p>
  
  <p>The third question that I had in my mind was about different syntax for writing the same query (e: the second method writing example below). What syntax is preferred and why?</p>
  
  <pre><code>from c in xmlDoc.Descendants
  where c.Attriubute("technical").Value == "true"
  select c.Element("site").Value;
  </code></pre>