dotnet / dotnet/csharpstandard
12.7.11.7 No specification of Equals and GetHashCode?
Open
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
Assessment
This issue has not been assessed yet.