title: How .NET determines equal objects in LINQ "select new"?
body: <p>Here is example:  </p>
  
  <pre><code>class A
  { 
      public long ParentId; 
      public string ParentName; 
      public string Name; 
  }
  
  // list is IEnumerable&lt;A&gt;
  var selected = list
      .Select(x =&gt; new {
          parent = new {
              id = x.ParentId,
              name = x.ParentName
          }
          name = x.Name
      });
  var grouped = selected.GroupBy(x =&gt; x.parent);
  </code></pre>
  
  <p>So, as grouping completed successfully, I make conclusion, that <code>parent</code> is not created for two different entities if both of them have the same <code>ParentId</code> and <code>ParentName</code>. By other words, if <code>list[i].ParentId == list[j].ParentId</code> and <code>list[i].ParentName == list[j].ParentName</code>, then after selecting <code>selected[i].parent == selected[j].parent</code>.<br>
  Am I right? I thought, that <code>new</code> creates new object on every iteration through source collection. How .NET does this?</p>