GroupBy and OrderBy Methods

Learn how to group and order the elements of a collection using GroupBy and OrderBy methods.

How to group elements of a collection

The GroupBy method groups the elements of a collection based on a grouping key. This method returns a collection of groups, or buckets, organized by that key.

For example, let’s group our movies by rating.

Get hands-on with 1200+ tech skills courses.