0

If i have a List that has values like

public class List
    {
        public string Category{ get; set; }
        public string SubCategory{ get; set; }
        public int Count { get; set; }           
    }

Eg:

Cat1
subCat1
3

Cat1
subCat2
4  

Cat2
subCat2
2   

Cat2
subCat3
4

How can i group the Categories and Show it? i tried this

var list2 = list
                  .GroupBy(t=>t.Category,t=>t.Subcategory)
                .Select(g=>(g)).ToList();

But looks like i am missing something

Night Monger
  • 700
  • 1
  • 8
  • 24

0 Answers0