You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is no any other option for implementing GetHashCode when the class contains only mutable members.
The Roslynator complains with: RCS1132 Remove redundant overriding member.
I suggest to not show RCS1132 for GetHashCode in a such case:
classA{publicintI{get;set;}publicoverrideboolEquals(object?other)=> other is A a && a.I == other.I;publicoverrideintGetHashCode()=>base.GetHashCode();// Explicit due to CS0659}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When a class implements only Equals there is a warning CS0659
'A' overrides Object.Equals(object o) but does not override Object.GetHashCode().
However, when the GetHashCode is provided explicitly:
There is no any other option for implementing GetHashCode when the class contains only mutable members.
The Roslynator complains with: RCS1132 Remove redundant overriding member.
I suggest to not show RCS1132 for GetHashCode in a such case:
Beta Was this translation helpful? Give feedback.
All reactions