Created
June 10, 2024 07:43
-
-
Save jondjones/2c66601607afe8b475fd2f5c5ffdae36 to your computer and use it in GitHub Desktop.
7 New Linq Methods You Need To Know About - 8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fruits = new List<string> { "apple", "banana", "apple", "orange", "banana", "apple" }; | |
var fruitCount = fruits.GroupBy(fruit => fruit) | |
.Select(group => new { Fruit = group.Key, Count = group.Count() }) | |
.ToList(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment