title: Linq union two tables where on has an extra column
body: <p>I am using a <code>Union</code> to combine two tables <code>audit</code> and <code>message</code>.  They both have all the same column names except <code>audit</code> has an extra column called <code>deleteDate</code>. I am try to use a <code>Union</code> to merge both table where if <code>deleteDate</code> does not exist, than it sets the <code>DeleteDate</code> method to null.  I commented out what I am trying to get to work.  When I uncomment the code, I get an error.  Is there a work around? Here is my code </p>
  
  <pre><code>    var audit = from a in _Audit.GetAll()
                         .Where(a =&gt; a.PInt == pInt &amp;&amp; a.CreateDate &lt; startDate &amp;&amp; (endDate == null || endDate &gt; a.CreateDate))
                         select new
                         {
                             a.MInt,
                             a.MId,
                             a.Desc,
                             a.PString,
                             a.PType,
                             a.MType,
                             a.CreateDate,
                             //    a.DeleteDate,
                             a.PInt
                         };
  
      var message = from a in _Message.GetAll()
             .Where(a =&gt; a.PartnerInt == partnerInt &amp;&amp; a.CreateDate &lt; startDate &amp;&amp; (endDate == null || endDate &gt; a.CreateDate))
                    select new
                    {
                        a.MInt,
                        a.MId,
                        a.Desc,
                        a.PString,
                        a.PType,
                        a.MType,
                        a.CDate,
                        a.PInt
                    };
  
      var test = from a in audit.Union(message)
                 select new AuditMessagesGroup
                 {
                     MInt = a.Int,
                     MId = a.Id,
                     Desc = a.Desc,
                     PString = a.PString,
                     PType = a.PayloadType,
                     MessageType = a.MType,
                     CreateDate = a.CreateDate,
           //          DeleteDate = a.DeleteDate != null ? a.DeleteDate : null,
                     PInt = a.PInt
  
                 };
  </code></pre>
  
  <p>Here is the error</p>
  
  <pre><code>    Error   CS1929  'IQueryable&lt;&lt;anonymous type: int MInt, Guid 
  
  MId, string Desc, string PString, string PType, 
  
  MTypes MType, DateTime CreateDate, DateTime DeleteDate, int? 
  
  PInt&gt;&gt;' does not contain a definition for 'Union' and the best 
  
  extension method overload 'ParallelEnumerable.Union&lt;&lt;anonymous type: int 
  
  MInt, Guid MId, string Desc, string PString, string 
  
  PType, MTypes MType, DateTime CreateDate, int? PInt&gt;&gt;
  
  (ParallelQuery&lt;&lt;anonymous type: int MInt, Guid MId, string 
  
  Desc, string PString, string PType, MTypes 
  
  MType, DateTime CreateDate, int? PInt&gt;&gt;, IEnumerable&lt;&lt;anonymous 
  
  type: int MInt, Guid MId, string Desc, string 
  
  PString, string PType, MTypes MType, DateTime 
  
  CreateDate, int? PInt&gt;&gt;)' requires a receiver of type 
  
  'ParallelQuery&lt;&lt;anonymous type: int MInt, Guid MId, string 
  
  Desc, string PString, string PType, MTypes 
  
  MType, DateTime CreateDate, int? PInt&gt;&gt;'    
  </code></pre>