title: LINQ right join and left join
body: <p>My task is refactor some t-sql queries to LINQ. Simple join and left outer join are clear. Here is my code:</p>
  
  <pre><code>string[] leftouter = new string[] { "a", "b", "c", "d", "e" };
  string[] inner     = new string[] { "a", "b" };
  
  var q = from s1 in leftouter
          join s2 in inner on s1 equals s2 into j
          from sj in j.DefaultIfEmpty() 
          select string.Format("Outer: {0} Left: {1}", s1, sj)
  </code></pre>
  
  <p>The output is:    </p>
  
  <pre><code>Outer: a Left: a  
  Outer: b Left: b  
  Outer: c Left:   
  Outer: d Left:   
  Outer: e Left:   
  </code></pre>
  
  <p>This is a simple left join. Now I would like to add a new dataset:</p>
  
  <pre><code>string[] rightouter = new string[] { "c", "d", "e" };  
  </code></pre>
  
  <p>The desired output is:  </p>
  
  <pre><code>Outer: a Left: a Right:  
  Outer: b Left: b Right:  
  Outer: c Left:   Right: c
  Outer: d Left:   Right: d
  Outer: e Left:   Right: e
  </code></pre>
  
  <p>How can I reformat the LINQ to solve this output? Thanks</p>