Code Analysis Error: "does not override 'Object.Equals(object o)' and 'Object.GetHashCode()'"

Hi. I'm using version the CommandLine tools, version 2017.1.20170407.131846

My class definition is

--------

    public sealed class ChangeId
    {
        public override bool Equals(object obj)
        {
        }

        public override int GetHashCode()
        {
        }

        public static bool operator ==(ChangeId changeId1, ChangeId changeId2)
        {
        }

        public static bool operator !=(ChangeId changeId1, ChangeId changeId2)
        {
        }
    }

--------

However, analysis using the CommandLine Tools throws the error:

warning CSharpWarnings: :CS0660,CS0661: 'ChangeId' defines operator '==' or operator '!=' but does not override 'Object.Equals(object o)' and 'Object.GetHashCode()'

What am I doing wrong?

Thank you for your time

0
1 comment

Hello!

 

Thank you for contacting us.

Is this exactly the code which you tried to analyze with CLT? Strangely it's missing return values and there should be correspondent error.

Thank you.

0

Please sign in to leave a comment.