dotnet / dotnet/efcore

Support .NET 9.0 CountBy

Open
#33,177 0 comments 2 reactions 0 assignees View on GitHub
area-query
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

[Release notes](https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-9/overview#linq)
[Docs](https://learn.microsoft.com/en-us/dotnet/api/system.linq.enumerable.countby?view=net-9.0)

```c#
KeyValuePair mostFrequentWord = sourceText
.Split(new char[] { ' ', '.', ',' }, StringSplitOptions.RemoveEmptyEntries)
.Select(word => word.ToLowerInvariant())
.CountBy(word => word)
.MaxBy(pair => pair.Value);
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.