title: Uncommon elements in multiple lists
body: <p>I have multiple lists and i want to find distinct uncommon elements in everylist.</p>
  
  <p>I came to a point but couldnt managed to get the uncommon elements but ended up common elements.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
      {
          List&lt;DataTable&gt; dataTables = new List&lt;DataTable&gt;();
  
          List&lt;string&gt; c = new List&lt;string&gt;();
          c.Add("A");
          c.Add("B");
          c.Add("C");
          dataTables.Add(ss(c));            
          c.Add("B");
          c.Add("C");
          dataTables.Add(ss(c));
          c.Add("A");
          c.Add("B");
          dataTables.Add(ss(c));
  
  
          var setsOfIds = dataTables.Select(t =&gt; t.AsEnumerable().Select(x =&gt; x.Field&lt;string&gt;("ELIGIBLE")).OfType&lt;string&gt;());                        
          var commonIds = IntersectAll&lt;string&gt;(setsOfIds);
          var rows = dataTables.SelectMany(t =&gt; t.AsEnumerable()).Where(r =&gt; commonIds.Contains(r.Field&lt;string&gt;("ELIGIBLE")));
          var resultRows = rows.GroupBy(r =&gt; r.Field&lt;string&gt;("TEDARIKCI")).Select(r =&gt; r.First());
  
      }
  
      private DataTable ss(List&lt;string&gt; aa)
      {
          DataTable dt = new DataTable("x");
          dt.Columns.Add("ELIGIBLE", typeof(string));
          DataRow dr = null;//= dt.NewRow();
  
          foreach (string item in aa)
          {
              dr = dt.NewRow();
              dr[0] = item;
              dt.Rows.Add(dr);
          }
  
          return dt;
      }
  
      public List&lt;T&gt; IntersectAll&lt;T&gt;(IEnumerable&lt;IEnumerable&lt;T&gt;&gt; lists)
      {
          HashSet&lt;T&gt; hashSet = null;
          foreach (var list in lists)
          {
              if (hashSet == null)
              {
                  hashSet = new HashSet&lt;T&gt;(list);                    
              }
              else
              {
                  hashSet.IntersectWith(list);
              }
          }
          return hashSet == null ? new List&lt;T&gt;() : hashSet.ToList();
      }
  </code></pre>
  
  <p>IntersectAll does not help me because it gives me A,B,C. But i only want B (which is common to all of each list)</p>
  
  <p>I would appreciate if s.o. could give a sample. This is driving me crazy!! Pleeeeaaseeee</p>