title: Left outer join between two datatable on linq
body: <p>I have a two tables:</p>
  
  <pre><code>id | code      code | name
  ----------    -------------
  1  | 001       001  | first
  2  | 002       002  | second
  3  | 001
  </code></pre>
  
  <p>Result must be</p>
  
  <pre><code>id | name
  ----------
  1  | fisrt
  2  | second
  3  | first
  </code></pre>
  
  <p>My linq query:</p>
  
  <pre><code>var query = from content in result.Tables["Special_Contents_Tree"].AsEnumerable()
              join iNames in result.Tables["Special_Contents_ItemNames"].AsEnumerable()
              on content.Field&lt;Nullable&lt;Int16&gt;&gt;("Code") equals iNames.Field&lt;Nullable&lt;Int16&gt;&gt;("Code") into outer
              from gr in outer.DefaultIfEmpty()
              select new
              {
                ID = (Int16)content["ID"],
                Name = gr["Name"]
              };
  
  DataTable SpecialContent = new DataTable();
  SpecialContent.Columns.Add("ID");
  SpecialContent.Columns.Add("Name");
  foreach (var q in query)
  {
     SpecialContent.Rows.Add(q.ID, q.Name);
  }
  </code></pre>
  
  <p>But result is wrong - <code>result.Tables["Special_Contents_Tree"].Rows.Count = 323</code> then <code>SpecialContent.Rows.Count</code> should be too 323, but <code>SpecialContent.Rows.Count = 484</code>.</p>