Bug in System.Drawing.Color.Equals() still present in 4.7. RRS feed

  • Question

  • I tried to report this bug to MS but couldn't get past the many redirections to new pages, etc.

    Color.Equals() up to .NET 4.7 is wrong. It compares with


    Which is different from the == operator. This bug has been fixed in mono and in Color.cs in corefx but not in the .NET Framework.


    Friday, June 29, 2018 4:59 PM

All replies

  • Hi itg,

    Thank you for posting here.

    When == is used on an expression of type object, it'll resolve to System.Object.ReferenceEquals.

    Equals is just a virtual method and behaves as such, so the overridden version will be used (which, for string type compares the contents).

    If you want to know more about the difference between == and .Equals, you could refer to the article in code project.

    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, July 2, 2018 7:53 AM
  • Hi, Wendy

    But why does the string compare with itself? 


    Monday, July 2, 2018 5:13 PM