This is a similar question to This previus question but in my case I don't know how many items I have to put in each list.
I have a Class "Items" with this properties
public class Items{
public Id { get; set;}
public String ItemA { get; set;}
public String ItemB { get; set;}
public String ItemC { get; set;}
public String ItemD { get; set;}
public String ItemE { get; set;}
}
// And a List of Items
List<Items> ....
This list has these values:
How can I Split this List into a new List<List<Items>>
Grouping by ItemA and ItemB?
In this example the expected result whould be:
List[0] = {1, 10, 20, 30, 40, 50},
{4, 10, 20, 31, 40, 12}
List[1] = {2, 10, 19, 30, 40, 50}
List[2] = {3, 9, 20, 40, 30, 50},
{5, 9, 20, 30, 40, 50},
{6, 9, 20, 41, 40, 12}