title: DataTable Join using LINQ in C#
body: <p>I am joining two data tables using LINQ this way:</p>
  
  <pre><code> DataTable targetTable = dataTable1.Clone();
   var dt2Columns = dataTable2.Columns.OfType&lt;DataColumn&gt;().Select(dc =&gt;
          new DataColumn(dc.ColumnName, dc.DataType, dc.Expression, dc.ColumnMapping));
   var dt2FinalColumns = from dc in dt2Columns.AsEnumerable()
                         where targetTable.Columns.Contains(dc.ColumnName) == false
                         select dc;
   targetTable.Columns.AddRange(dt2FinalColumns.ToArray());
  
   var rowData = from row1 in dataTable1.AsEnumerable()
                 join row2 in dataTable2.AsEnumerable()
                 on row1.Field&lt;string&gt;("keyCol") equals row2.Field&lt;string&gt;("keyCol")
                 select row1.ItemArray.Concat(row2.ItemArray.Where(r2 =&gt; row1.ItemArray.Contains(r2) == false)).ToArray();
   foreach (object[] values in rowData)
       targetTable.Rows.Add(values);
  </code></pre>
  
  <p>I am facing three issues here: </p>
  
  <ol>
  <li>In case of row count is not same for two tables, I want to pass default value or assign empty string for values not found in other table. How do I achieve this ? </li>
  <li>If I have multiple columns and need to compare with AND how is that possible ?</li>
  <li>What if I have to join multiple tables in run time. Is there any way to generate dynamic LINQ ?</li>
  </ol>