What is GroupBy meant to do – Simple Explanation
As always we will try to formulate a simple explanation of what is really going on.
Airport
Imagine you are at an airport and (as always) there is a queue and planes are delayed. See below. What you will immediately notice is that all of the passengers are grouped together promiscuously – standing around in slumps in no particular order. Every body is mixed up with each other.
But, when you get into the plane, everybody is grouped into three distinct orders:
- First class
- Business class
- Third class. These classes are defined today by folks’ ability to pay. Unlike the olden days. Anyways, let’s move on.
That’s basically what group by does. It takes a promiscuous group and separates them into distinct orders – in this case, three distinct groups of people: first, business and third class.
So now you can say:
- Get me all the names of all the people in first class.
- Get me the names of all the people in the middle class who live in Europe.
And it’s as simple as that! As for the technicalities: please refer to the MSDN documentation – hopefully reading it won’t cause too much discomfort.
Leave a Reply