Click here to Skip to main content
15,612,595 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to get only those groups after GroupBy which satisfies some condition. How can I do do this? In SQL we have the 'having' clause, do we have something similar in LINQ?
I don't want to use if-else within the foreach loop.

1 solution

You can always filter your data before you group.

And you can do another LINQ query on the above results and filter as needed.
Share this answer
Brijesh_Guptra 4-Sep-12 3:25am    
Suppose I have to Group Order table By CustomerID and get only those groups which has more then 15 Orders
so how can I do that

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900