Rahul Singh

Rahul Singh

  • NA
  • 1.4k
  • 584.3k

C# LINQ

Oct 29 2014 2:55 AM
I know its easy to group objects by two properties but I was wondering is it possible to Group by either of two properties? Probably below example will make it more clear:-
Suppose I have this table:-

Now, i want to group this data either if CategoryIds are same or Fruits are same.
Sample Output:-
Group 1:-
1  Apple
1  Grapes
Group 2:-
2  Tablet
2  Laptop
Group 3:-
5  Coke6  Coke
CategoryID
Fruits
1
Apple
1
Grapes
2
Tablet
2
Laptop
5
Coke
6
Coke


Answers (7)