dotnet / dotnet/csharpstandard

12.7.11.7 No specification of Equals and GetHashCode?

Open
#114 11 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
C#
Stars
815
Forks
99
Avg merge
1d 14h
Merged PRs (30d)
16

Description

While we certainly don't want to pin down a single implementation of Equals and GetHashCode, I think it would be worth setting expectations around the results of:

``` csharp
var x = new { Name = "Jon" };
var y = new { Name = "Jon" };
var z = new { Name = "Mads" };
Console.WriteLine(x.Equals(y));
Console.WriteLine(x.Equals(z));
```

I think we'd want to mention:
- Use of `IEquatable` for property values, if indeed that's used
- null handling

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.