title: The type arguments cannot be inferred from the query
body: <p>my linq query works, I tested in the linqpad, got result back. the error happened at the last step, when I try to use EntityVM ViewModel.  I dont really understand what this error message means. can someone please explain that to me, and show me how to fix it. thank you.</p>
  
  <p><strong>Error Message: "the type arguments cannot be inferred from the query"</strong></p>
  
  <pre><code>        var entityVersions = EntityVersionRepository.Get().Where(x =&gt; x.Entity.ClientId == clientId);
  
  
          var groups = from ev in entityVersions
                       group ev by ev.EntityId
                           into g
                           select g.OrderByDescending(x =&gt; x.TaxYear).FirstOrDefault();
  
          var result = from g in groups
                       select (en =&gt; new EntityVM
                                         {
                                             Name = en.EntityName,
                                             Id = en.EntityId  
                                         });
  </code></pre>