title: How set OrderBy on GroupedEnumerable
body: <p>My result set is not sorting.  How do I set up OrderBy for type System.Linq.GroupedEnumerable </p>
  
  <p>I've converted an application from Core 1.1 to 2.2.  Everything ported over fine except one piece of logic that: 
  1) takes a response from a service call maps it to a GroupedEnumerable
  2) takes the grouped set and passes it to a function that maps it to an object of type System.Linq.Enumerable.SelectEnumerableIterator.</p>
  
  <p>The resulting object is properly populated but not sorted.  I have tried the order by in the function parameter call and as a separate process afterwards.</p>
  
  <pre><code>//response = {myService.myClient.SearchNominationsResponse}
  //groupedSet = {System.Linq.GroupedEnumerable&lt;ServiceClients.myClient.NominationObject, long&gt;}
  //result = {System.Linq.Enumerable.SelectEnumerableIterator&lt;System.Linq.IGrouping&lt;long, ServiceClients.myClient.NominationObject&gt;, app.ViewModels.EvaluationSummary&gt;}
  
  public IEnumerable&lt;EvaluationSummary&gt; GetEvaluationSummaries(string sortBy, string sortOrder, Filter filter = null)
  {      
      var request = Mapper.MapSearchNominationRequest(filter);
      request.IsDetailed = false;
  
      var response = myService.SearchNominationsAsync(request).GetAwaiter().GetResult();
  
      var groupedSet = response.mySet.GroupBy(n =&gt; n.SetId);
  
      // I get a proper result but it is not sorted
      var result = groupedSet.Select(
          g =&gt; Mapper.MapEvaluationSummary(
              g.OrderBy(g2 =&gt; sortBy + " " + sortOrder)
               .Last()));
  
      // Still not sorting
      result = result.OrderBy(r =&gt; sortBy + sortOrder);
      return result;    
  }    
  
  public EvaluationSummary MapEvaluationSummary(SetObject setIn)
  {
      var eval = new EvaluationSummary
      {
          setDate = setIn.Date,
          setId = setIn.Id,
          setTypeId = setIn.TypeId,
          setTypeDescription = setIn.TypeDescription,
          setStatusId = setIn.StatusId,
          setStatusDescription = setIn.StatusDescription,
          setBy = setIn.Manager,
          setEmployee = setIn.employee
      };
  }
  </code></pre>
  
  <p>So in my view I have columns that list Date, Id, setEmployee.  I can click on these values to issue a sort pattern and I can see that the sortBy and sortOrder variables are being passed in with proper values but the sorting is not happening.</p>
  
  <p>I expect 'William' to appear before 'Bill' and then Bill to appear before 'William' when toggling the employee column header in my view.</p>