Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- YoungGroup (<20 y old):
- Person1Name, Age
- Person4Name, Age
- Person3Name, Age
- AdultGroup (20> y <40 old):
- Person2Name, Age
- Person7Name, Age
- Person5Name, Age
- SeniorGroup (40> y old):
- Person6Name, Age
- Person8Name, Age
- Person9Name, Age
- var multiplegrps = from p in people
- group p by p.Age into groups
- let age = groups.Key
- select new
- {
- YoungGroup = from p in groups
- where age <= 20
- group p by p.Age,
- AdultGroup = from p in groups
- where age >= 21 && age <= 40
- group p by p.Age,
- SeniorGroup = from p in groups
- where age >= 41
- group p by p.Age
- };
Add Comment
Please, Sign In to add comment