dotnet / dotnet/dotnet-api-docs
Equals(Object) and GetHashCode() overrides look wrong
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
### Type of issue
Typo
### Description
In the definition of class Box in the code example, the override of Equals(Object) calls base.Equals(obj) which does not use the custom logic for equality defined in that class. It should call Equals(obj as Box) to use the custom logic. The overridden GetHashCode() should probably also be updated to use custom logic from class Box instead of calling the base class implementation.
### Page URL
https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.icollection-1?view=net-9.0#code-try-1
### Content source URL
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System.Collections.Generic/ICollection`1.xml
### Document Version Independent Id
d9a82967-6fd7-31b9-6fc9-377daa1a51d4
### Platform Id
9cb26e83-4075-c213-0708-b9ded52b04f6
### Article author
@dotnet-bot
Contributor guide
Assessment
This issue has not been assessed yet.