Skip to content

Warning CS0660 'class' defines operator == or operator != but does not override Object.Equals(object o). #7

Description

@f1fan44

As a general comment, warnings during compile time are an obstacle to development in a professional environment. There are four of these warnings in the UnitClassLibrary code.

The code appears to confuse the use of operator== with Equals(). operator== tests whether two object references point to the exact same object on the heap. Whereas Equals() tests whether two objects have the same "value" (by whatever definition you choose for equality.)

Suggest substituting Equals() for operator== in the classes. Suggest eliminating overriding operator!=, and using (! Equals()) wherever operator!= is used.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions