title: Check all properties in list of objects is equal
body: <p>Seems I am checking if the <code>Id</code> are all equal in a round-about way, is there a more succinct and easy to understand way to do the check?</p>
  
  <p>Something like a full outer join and checking for nulls?</p>
  
  <p>Specifically this part:</p>
  
  <pre><code>if (masters1.Count() != masters1.Intersect(masters2).Count())
  {
      throw new Exception("one IDs did not match two IDs");
  }
  
  if (masters2.Count() != masters2.Intersect(masters3).Count())
  {
      throw new Exception("two IDs did not match three IDs");
  }
  </code></pre>
  
  <p>Full example:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Configuration;
  using System.Data.SqlClient;
  using System.Linq;
  
  
          public class Record
          {
              public string Id;
              public string Value;
          }
  
          public class Records
          {
              public Record One;
              public Record Two;
              public Record Three;
          }
  
  public class Program
  {
      public static void Main()
      {
          var one = new List&lt;Record&gt;(){new Record(){Id = "one", Value = "1"},new Record(){Id = "two", Value = "2"}};
          var two = new List&lt;Record&gt;(){new Record(){Id = "one", Value = "1"},new Record(){Id = "two", Value = "2"}};
          var three = new List&lt;Record&gt;(){new Record(){Id = "one", Value = "1"},new Record(){Id = "two", Value = "2"}};
  
          var masters1 = one.Select(x =&gt; x.Id);
          var masters2 = two.Select(x =&gt; x.Id);
          var masters3 = three.Select(x =&gt; x.Id);
  
  
          if (masters1.Count() != masters1.Intersect(masters2).Count())
          {
              throw new Exception("one IDs did not match two IDs");
          }
  
          if (masters2.Count() != masters2.Intersect(masters3).Count())
          {
              throw new Exception("two IDs did not match three IDs");
          }
  
          var rv = new List&lt;Records&gt;();
          foreach (var master in masters1)
          {
              var record = new Records()
              {
                  One = one.Single(x =&gt; x.Id == master),
                  Two = two.Single(x =&gt; x.Id == master),
                  Three = three.Single(x =&gt; x.Id == master),
              };
  
              rv.Add(record);
          }
  
  
          foreach(var x in rv){
              Console.WriteLine(x.One.Value); 
              Console.WriteLine(x.Two.Value); 
              Console.WriteLine(x.Three.Value);   
          }
  
      }
  }
  </code></pre>
  
  <p>See here: <a href="https://dotnetfiddle.net/QtjM7x" rel="nofollow">https://dotnetfiddle.net/QtjM7x</a></p>