title: How to Join two IEnumerables with anonymous types?
body: <p>I'm using Linq-to-Xml to create two <code>IEnumerables</code> but I want to combine the results of the second list with the first list. When I use the <code>.Concat()</code> I get the following error:</p>
  
  <blockquote>
    <p>'IQueryable&lt;>' does not contain a definition for 'Concat' and the best extension method overload 'ParallelEnumerable.Concat&lt;>(ParallelQuery&lt;>, IEnumerable&lt;>)' requires a receiver of type 'ParallelQuery&lt;>'</p>
  </blockquote>
  
  <p>The two lists I'm trying to <code>.Concat()</code> are here:</p>
  
  <pre><code>var findingDetails = from f in element.Elements(ns + "Group")
                       select new
                       {
                           testID = (string)f.Attribute("id").Value,
                           title = (string)f.Element(ns + "title"),
                           idrefFD = (string)f.Element(ns + "Rule").Attribute("id").Value,
                           severity = (string)f.Element(ns + "Rule").Attribute("severity").Value,
                           description = (string)f.Element(ns + "Rule").Element(ns + "description"),
                           fixText = (string)f.Element(ns + "Rule").Element(ns + "fixtext")
                       };
  var getStatus = from gs in element.Descendants(ns + "rule-result")
                  select new
                  {
                      idrefStatus = (string)gs.Attribute("idref").Value,
                      result = (string)gs.Element(ns + "result"),
                      dateTime = (string)gs.Attribute("time")
                  };
  </code></pre>
  
  <p>The error is generated on the <code>findingDetails</code> usage here:</p>
  
  <pre><code>var combined = findingDetails.Concat(getStatus);
  </code></pre>
  
  <p>What I'm trying to get is a <code>var</code> with that has everything from <code>findingDetails</code> + <code>getStatus.result</code> and <code>getStatus.dateTime</code>, in one place. This why I only have to iterate over one <code>foreach()</code> loop to access all of the values instead of using a nested <code>foreach()</code> loop. </p>
  
  <p>Sample XML Document:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;cdf:Benchmark style="SCAP_1.1" resolved="1" id="RHEL_6_STIG" xsi:schemaLocation="http://checklists.nist.gov/xccdf/1.1 http://nvd.nist.gov/schema/xccdf-1.1.4.xsd http://cpe.mitre.org/dictionary/2.0 http://scap.nist.gov/schema/cpe/2.2/cpe-dictionary_2.2.xsd" xmlns:cdf="http://checklists.nist.gov/xccdf/1.1" xmlns:cpe="http://cpe.mitre.org/dictionary/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:xhtml="http://www.w3.org/1999/xhtml"&gt;
    &lt;cdf:status date="2016-04-22"&gt;accepted&lt;/cdf:status&gt;
    &lt;cdf:title&gt;Red Hat Enterprise Linux 6 Security Technical Implementation Guide&lt;/cdf:title&gt;
    &lt;cdf:description&gt;The Red Hat Enterprise Linux 6 Security Technical Implementation Guide (STIG) is published as a tool to improve the security of Department of Defense (DoD) information systems.  Comments or proposed revisions to this document should be sent via e-mail to the following address: disa.stig_spt@mail.mil.&lt;/cdf:description&gt;
    &lt;cdf:notice id="terms-of-use"&gt;&lt;/cdf:notice&gt;
    &lt;cdf:reference href="http://iase.disa.mil"&gt;
          &lt;dc:publisher&gt;DISA&lt;/dc:publisher&gt;
          &lt;dc:source&gt;STIG.DOD.MIL&lt;/dc:source&gt;
    &lt;/cdf:reference&gt;
    &lt;cdf:plain-text id="release-info"&gt;Release: 11 Benchmark Date: 22 Apr 2016&lt;/cdf:plain-text&gt;
    &lt;cdf:platform idref="cpe:/o:redhat:enterprise_linux:6"&gt;&lt;/cdf:platform&gt;
    &lt;cdf:version&gt;1&lt;/cdf:version&gt;
    &lt;cdf:Profile id="MAC-1_Classified"&gt;
          &lt;cdf:title&gt;I - Mission Critical Classified&lt;/cdf:title&gt;            
    &lt;/cdf:Profile&gt;
    &lt;cdf:Value id="var_umask_for_daemons"&gt;
          &lt;cdf:title&gt;daemon umask&lt;/cdf:title&gt;
          &lt;cdf:description&gt;Enter umask for daemons&lt;/cdf:description&gt;
          &lt;cdf:value&gt;022&lt;/cdf:value&gt;
          &lt;cdf:value selector="022"&gt;022&lt;/cdf:value&gt;
          &lt;cdf:value selector="027"&gt;027&lt;/cdf:value&gt;
    &lt;/cdf:Value&gt;
    &lt;cdf:Group id="V-7055"&gt;
          &lt;cdf:title&gt;APPNET0031 No Strong Name Verification&lt;/cdf:title&gt;
                &lt;cdf:description&gt;&amp;lt;GroupDescription&amp;gt;&amp;lt;/GroupDescription&amp;gt;&lt;/cdf:description&gt;
              &lt;cdf:Rule weight="10.0" id="SV-7438r2_rule" severity="medium"&gt;
                    &lt;cdf:version&gt;APPNET0031&lt;/cdf:version&gt;
                    &lt;cdf:title&gt;Digital signatures assigned to strongly named assemblies must be verified.&lt;/cdf:title&gt;
                    &lt;cdf:description&gt;&amp;lt;VulnDiscussion&amp;gt;A strong name consists of the assembly's identity, simple text name, version number, and culture information (if provided)—plus a public key and a digital signature.  Strong names serve to identify the author of the code.  If digital signatures used to sign strong name assemblies are not verified, any self signed code can be impersonated.  This can lead to a loss of system integrity. &amp;lt;/VulnDiscussion&amp;gt;&amp;lt;FalsePositives&amp;gt;&amp;lt;/FalsePositives&amp;gt;&amp;lt;FalseNegatives&amp;gt;&amp;lt;/FalseNegatives&amp;gt;&amp;lt;Documentable&amp;gt;false&amp;lt;/Documentable&amp;gt;&amp;lt;Mitigations&amp;gt;&amp;lt;/Mitigations&amp;gt;&amp;lt;SeverityOverrideGuidance&amp;gt;&amp;lt;/SeverityOverrideGuidance&amp;gt;&amp;lt;PotentialImpacts&amp;gt;&amp;lt;/PotentialImpacts&amp;gt;&amp;lt;ThirdPartyTools&amp;gt;&amp;lt;/ThirdPartyTools&amp;gt;&amp;lt;MitigationControl&amp;gt;&amp;lt;/MitigationControl&amp;gt;&amp;lt;Responsibility&amp;gt;System Administrator&amp;lt;/Responsibility&amp;gt;&amp;lt;IAControls&amp;gt;DCSL-1&amp;lt;/IAControls&amp;gt;&lt;/cdf:description&gt;
                    &lt;cdf:reference&gt;
                          &lt;dc:publisher&gt;DISA&lt;/dc:publisher&gt;
                          &lt;dc:identifier&gt;2030&lt;/dc:identifier&gt;
                          &lt;dc:type&gt;DPMS Target&lt;/dc:type&gt;
                    &lt;/cdf:reference&gt;
                    &lt;cdf:fixtext fixref="F-12596r7_fix"&gt;Use regedit to remove the values stored in Windows registry key hKLM\Software\Microsoft\StrongName\Verification. There should be no assemblies or hash values listed under this registry key. All assemblies must require strong name verification in a production environment. Strong name assemblies that do not require verification in a development or test environment must have documented approvals from the IAO.&lt;/cdf:fixtext&gt;
                    &lt;cdf:fix id="F-12596r7_fix"&gt;&lt;/cdf:fix&gt;
                    &lt;cdf:check system="http://oval.mitre.org/XMLSchema/oval-definitions-5"&gt;
                          &lt;cdf:check-content-ref href="U_Microsoft_DotNet_Framework_4_V1R4_STIG_SCAP_1-1_Benchmark-oval.xml" name="oval:mil.disa.fso.dotnet:def:2"&gt;&lt;/cdf:check-content-ref&gt;
                    &lt;/cdf:check&gt;
              &lt;/cdf:Rule&gt;
        &lt;/cdf:Group&gt;
        &lt;cdf:TestResult start-time="2016-07-20T11:59:59" version="1" test-system="cpe:/a:spawar:scc:4.1" end-time="2016-07-20T12:00:50" id="U_Microsoft_DotNet_Framework_4_V1R4_STIG_SCAP_1-1_Benchmark-xccdf.xml---MAC-2_Classified-1"&gt;
              &lt;cdf:benchmark href="U_Microsoft_DotNet_Framework_4_V1R4_STIG_SCAP_1-1_Benchmark-xccdf.xml"&gt;&lt;/cdf:benchmark&gt;
              &lt;cdf:organization&gt;SPAWAR Systems Center Atlantic&lt;/cdf:organization&gt;
              &lt;cdf:identity privileged="true" authenticated="true"&gt;CCSAdmin&lt;/cdf:identity&gt;
              &lt;cdf:profile idref="MAC-2_Classified"&gt;&lt;/cdf:profile&gt;
              &lt;cdf:target&gt;hostname&lt;/cdf:target&gt;
              &lt;cdf:target-address&gt;192.168.1.000&lt;/cdf:target-address&gt;
              &lt;cdf:target-facts&gt;
                    &lt;cdf:fact name="urn:scap:fact:asset:identifier:host_name" type="string"&gt;hostname&lt;/cdf:fact&gt;
                    &lt;cdf:fact name="urn:scap:fact:asset:identifier:domain" type="string"&gt;.net&lt;/cdf:fact&gt;
                    &lt;cdf:fact name="urn:scap:fact:asset:identifier:fqdn" type="string"&gt;hostname.net&lt;/cdf:fact&gt;
                    &lt;cdf:fact name="urn:scap:fact:asset:identifier:os_name" type="string"&gt;Windows 7 Enterprise&lt;/cdf:fact&gt;
                    &lt;cdf:fact name="urn:scap:fact:asset:identifier:os_service_pack" type="string"&gt;Service Pack 1&lt;/cdf:fact&gt;
                    &lt;cdf:fact name="urn:scap:fact:asset:identifier:ipv4" type="string"&gt;192.168.1.000&lt;/cdf:fact&gt;
              &lt;/cdf:target-facts&gt;
              &lt;cdf:platform idref="cpe:/a:microsoft:.net_framework:4.0"&gt;&lt;/cdf:platform&gt;
              &lt;cdf:rule-result version="APPNET0031" time="2016-07-20T11:59:59" idref="SV-7438r2_rule" weight="10.0" severity="medium"&gt;
                    &lt;cdf:result&gt;pass&lt;/cdf:result&gt;
                    &lt;cdf:check system="http://oval.mitre.org/XMLSchema/oval-definitions-5"&gt;
                          &lt;cdf:check-content-ref href="U_Microsoft_DotNet_Framework_4_V1R4_STIG_SCAP_1-1_Benchmark-oval.xml" name="oval:mil.disa.fso.dotnet:def:2"&gt;&lt;/cdf:check-content-ref&gt;
                    &lt;/cdf:check&gt;
               &lt;/cdf:rule-result&gt;
              &lt;cdf:rule-result version="APPNET0046" time="2016-07-20T11:59:59" idref="SV-7444r3_rule" weight="10.0" severity="medium"&gt;
                    &lt;cdf:result&gt;fail&lt;/cdf:result&gt;
                    &lt;cdf:fix id="F-12602r12_fix"&gt;&lt;/cdf:fix&gt;
                    &lt;cdf:check system="http://oval.mitre.org/XMLSchema/oval-definitions-5"&gt;
                          &lt;cdf:check-content-ref href="U_Microsoft_DotNet_Framework_4_V1R4_STIG_SCAP_1-1_Benchmark-oval.xml" name="oval:mil.disa.fso.dotnet:def:15"&gt;&lt;/cdf:check-content-ref&gt;
                    &lt;/cdf:check&gt;
              &lt;/cdf:rule-result&gt;
        &lt;/cdf:TestResult&gt;
  &lt;/cdf:Benchmark&gt;
  </code></pre>
  
  <p>I changed the queries and now both look like this: </p>
  
  <pre><code>var findingDetails = from f in element.Elements(ns + "Group")
                                   select new
                                   {
                                       idrefStatus = (string)"",
                                       result = (string)"",
                                       dateTime = (string)"",
                                       testID = (string)f.Attribute("id").Value,
                                       title = (string)f.Element(ns + "title"),
                                       idref = (string)f.Element(ns + "Rule").Attribute("id").Value,
                                       severity = (string)f.Element(ns + "Rule").Attribute("severity").Value,
                                       description = (string)f.Element(ns + "Rule").Element(ns + "description"),
                                       fixText = (string)f.Element(ns + "Rule").Element(ns + "fixtext")                                         
                                   };
              var getStatus = from gs in element.Descendants(ns + "rule-result")
                              select new
                              {
                                  idrefStatus = (string)gs.Attribute("idref").Value,
                                  result = (string)gs.Element(ns + "result"),
                                  dateTime = (string)gs.Attribute("time"),
                                  testID = (string)"",
                                  title = (string)"",
                                  idref = (string)"",
                                  severity = (string)"",
                                  description = (string)"",
                                  fixText = (string)""
                              };
  
   var combined = findingDetails.Concat(getStatus);
  </code></pre>
  
  <p>But now the output looks like this</p>
  
  <pre><code>foreach (var cf in combined)
  {
       Console.WriteLine(cf.idref + ", " + cf.result);
  }
  
  SV-7438r2_rule, 
  SV-7444r3_rule, 
  SV-40966r1_rule, 
  SV-41075r1_rule, 
  , pass
  , fail
  , pass
  , pass
  </code></pre>
  
  <p>Whereas, I'm trying to get something like this:</p>
  
  <pre><code>SV-7438r2_rule, pass
  SV-7444r3_rule, fail
  SV-40966r1_rule, pass
  SV-41075r1_rule, pass
  </code></pre>