dotnet / dotnet/dotnet-api-docs

Equals vs GetHashCode using GroupBy

Open
#1,470 3 comments 0 reactions 0 assignees View on GitHub
area-System.Linq dotnet-api/prod Pri2 untriaged
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

Apparently not only the equality function is being called but also the GetHashCode when using GroupBy with
GroupBy<TSource,TKey>(IEnumerable<TSource>, Func<TSource,TKey>).
There isn't anything said about GetHashCode in the documentation.

---
#### Document Details

⚠ *Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.*

* ID: 2bee8281-80cd-8648-6425-d39ef3cfd90a
* Version Independent ID: 9126a563-3b4c-fc7f-60a7-1c19ea26dddb
* Content: [Enumerable.GroupBy Method (System.Linq)](https://docs.microsoft.com/en-us/dotnet/api/system.linq.enumerable.groupby?view=netframework-4.7.2#System_Linq_Enumerable_GroupBy__2_System_Collections_Generic_IEnumerable___0__System_Func___0___1__)
* Content Source: [xml/System.Linq/Enumerable.xml](https://github.com/dotnet/dotnet-api-docs/blob/master/xml/System.Linq/Enumerable.xml)
* Product: **dotnet-api**
* GitHub Login: @dotnet-bot
* Microsoft Alias: **dotnetcontent**

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.