title: Which item is returned from Intersect, the one from first or from second enumerable?
body: <p>I have an item object:</p>
  
  <pre><code>class Item : IEquatable&lt;Item&gt;
  {
     public string Id { get; }
     public string Name { get; }
  
      public override bool Equals(object obj)
      {
          return Equals(obj as Item);
      }
  
      public bool Equals(Item other)
      {
          return other != null &amp;&amp; Id == other.Id;
      }
  
      public override int GetHashCode()
      {
          return 2108858624 + Id.GetHashCode();
      }   
  }
  </code></pre>
  
  <p>Doing the intersection:</p>
  
  <pre><code>Item[] items1 = new Item[] { new Item() { Id = 1, Name = 1 } };
  Item[] items2 = new Item[] { new Item() { Id = 1, Name = 2 } };
  
  IEnumerable&lt;Item&gt; intersection = items1.Intersect(items2).ToList();
  </code></pre>
  
  <p>it shows that it chooses item with <code>Name = 1</code>.</p>
  
  <p>My question is it guaranteed that <code>Intersect</code> always chooses items from the first enumerable and not the second? I could not find any information about which instance does <code>Intersect</code> exactly chooses. </p>
  
  <p><strong>I realize since two items are equal, I should not need to know which instance is chosen by <code>Intersect</code>. But here's my scenario:</strong></p>
  
  <p>Imagine a scenario where there are items stored in the app locally and they need to be merged with items coming from a backend. An online item with same id might have <code>Name</code> updated, but it's still "same item" with an item stored locally. That's why is important to understand which instance does <code>Intersect</code> chooses.</p>
  
  <p>So maybe my problem is somewhere else?</p>
  
  <p>.NET allows us to override what "equality" between two objects means. However, when using <code>Intersect</code> and other LINQ stuff, things seem a bit blurry to me.</p>