title: How to Split a object list into sublists grouping by elements(dateTime and String) C#
body: <p>Im tring to make sub-list based on main list with 9 records according to datetime ascending order &amp; then pcName(string).</p>
  
  <p>my sorted sublist need to be like below</p>
  
  <p><strong>ObjectList 1 :</strong></p>
  
  <p>2615,2019-11-22 16:03:22.<strong>150</strong>,<strong>Test1</strong></p>
  
  <p>2615,2019-11-22 16:03:22.<strong>200</strong>,<strong>Test1</strong></p>
  
  <p>2615,2019-11-22 16:03:22.<strong>250</strong>,<strong>Test1</strong></p>
  
  <p>2615,2019-11-22 16:03:22.<strong>300</strong>,<strong>Test1</strong></p>
  
  <p><strong>ObjectList 2 :</strong></p>
  
  <p>2615,2019-11-22 16:03:22.<strong>350</strong>,<strong>Test2</strong></p>
  
  <p>2615,2019-11-22 16:03:22.<strong>400</strong>,<strong>Test2</strong></p>
  
  <p><strong>ObjectList 3 :</strong></p>
  
  <p>2615,2019-11-22 16:03:22.<strong>450</strong>,<strong>Test1</strong></p>
  
  <p>2615,2019-11-22 16:03:22.<strong>500</strong>,<strong>Test1</strong></p>
  
  <p><strong>ObjectList 4 :</strong></p>
  
  <p>2615,2019-11-22 16:03:22.<strong>550</strong>,<strong>Test3</strong></p>
  
  <p>This object list need to take according to sequence ObjectList[0] ,ObjectList[1] ,ObjectList[2]  and ObjectList[3] </p>
  
  <p>I mentioned below my sample code</p>
  
  <p>But this only provides me 3 sublist sets(Item1) filter based with <strong>Test1, Test2 &amp; Test3</strong> and 9 sublists but i want as above 4 sub lists. where i want to change code ?? <strong>Please help me</strong></p>
  
  <pre><code>private void button_Click(object sender, EventArgs e)
          {
              List&lt;Identity&gt; listOfIdentity = new List&lt;Identity&gt;()
              {
                 new Identity() {id= 2615,QCTime=DateTime.Parse("2019-11-22 16:03:22.550"),PcName="Test3"},                              
                 new Identity() {id= 2615,QCTime=DateTime.Parse("2019-11-22 16:03:22.300"), PcName="Test1"},                            
                 new Identity() {id= 2615,QCTime=DateTime.Parse("2019-11-22 16:03:22.350"), PcName="Test2"},
                 new Identity() {id= 2615,QCTime=DateTime.Parse("2019-11-22 16:03:22.400"), PcName="Test2"},
                 new Identity() {id= 2615,QCTime=DateTime.Parse("2019-11-22 16:03:22.200"), PcName="Test1"},
                 new Identity() {id= 2615,QCTime=DateTime.Parse("2019-11-22 16:03:22.500"), PcName="Test1"},
                 new Identity() {id= 2615,QCTime=DateTime.Parse("2019-11-22 16:03:22.250"), PcName="Test1"},
                 new Identity() {id= 2615,QCTime=DateTime.Parse("2019-11-22 16:03:22.450"), PcName="Test1"},
                 new Identity() {id= 2615,QCTime=DateTime.Parse("2019-11-22 16:03:22.150"), PcName="Test1"}              
              };
              List&lt;Identity&gt; sortedIdentity = listOfIdentity.OrderBy(x =&gt; x.QCTime).ThenBy(x =&gt; x.PcName).ToList(); // here i order by time and then pc name
  
              var items1 = listOfIdentity.OrderBy(x =&gt; x.QCTime).ThenBy(x =&gt; x.PcName).GroupBy(x =&gt; x.PcName).Select(grp =&gt; grp.ToList()).ToList(); //sub list create based with **Test1, Test2 &amp; Test3** (3 sub lists)
              var items2 = listOfIdentity.OrderBy(x =&gt; x.QCTime).ThenBy(x =&gt; x.PcName).GroupBy(x =&gt; new { x.QCTime, x.PcName }).Select(grp =&gt; grp.ToList()).ToList(); //sub list create based with each time and pc name (9 sublists)
          }
  
          class Identity
          {
              public int id { get; set; }
              public DateTime QCTime { get; set; }
              public string PcName { get; set; }
          }
  </code></pre>