title: Splitting an ordered list
body: <p>I am trying to create a sorted list of lists. Where the outer "layer" is sorted  by the field BU. and the inner layer is sorted by JobNum. I have this method, and variables.</p>
  
  <pre><code>public List&lt;string&gt; ListSorter&lt;T&gt;(IEnumerable&lt;T&gt; records)where T : 
  IMapToCSVSource, new()
  
  List&lt;IEnumerable&lt;T&gt;&gt; organizedRecords = new List&lt;IEnumerable&lt;T&gt;&gt;();
  List&lt;T&gt; shortenedRecord = new List&lt;T&gt;();
  </code></pre>
  
  <p>Here I am trying to create a more concise object with only 3 specific fields instead of the possible 8 that comes with the records object. BU and JobNum are set within this method.         </p>
  
  <pre><code>foreach (var record in records)
  {
      string businessUnit = "research"; //This would vary each loop, not constant as displayed
      string JobNum = "test"       //this would vary each loop, not constant as displayed
      shortenedRecord.Add(new T()
      {
          Cost = record.Cost,
          BU = businessUnit,
          JobNum = jobNum
      });
  }
  shortenedRecord.OrderBy(o =&gt; o.BU).ThenBy(n=&gt;n.JobNum);
  </code></pre>
  
  <p>here, to my knowledge, now has all the records shortened and ordered by BU, then JobNum.</p>
  
  <p>Now I want to Split this ordered list into sections of BU specific records and add it to organizedRecords. Such that each element of organizedRecords is a specific BU. How would I do this?</p>
  
  <p>For example, say shortenedRecord is a list of 30 elements, but there is only a total of 5 unique BU values. I would like to order and SPLIT the list into their 5 respective BU values, and add it to organizedRecords.</p>
  
  <p>such that:</p>
  
  <p>organizedRecords[0] should be a list of 'corporate' records</p>
  
  <p>organizedRecords[1] should be a list of 'research' records </p>
  
  <p>where corporate and research are BU values.</p>
  
  <p>I tried to explain as best I could. Thank you for any suggestions. </p>