Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 783179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:30:23+00:00 2026-05-14T20:30:23+00:00

From MSDN documentation, it seems as both GetHashCode() and Equals() haven’t been overriden in

  • 0

From MSDN documentation, it seems as both GetHashCode() and Equals() haven’t been overriden in Bitmap. Neither have them been overriden in Image. So both classes are using the Object’s version of them just compares references. I wasn’t too convinced so I decided to fire up Reflector to check it out. It seems MSDN is correct in that matter.

So, is there any special reason why MS guys wouldn’t implement “comparison logic”, at least for the Bitmap class? I find it is kinda acceptable for Image, as it is an abstract class, but not so much for the Bitmap class. I can see in a lot of situations calculating the hash code can be an expensive operation, but it’d be alright if it used some kind of caching.

When wanting to compare 2 bitmaps, will I have to resort to having to run all over the picture comparing each one of its pixels?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:30:24+00:00Added an answer on May 14, 2026 at 8:30 pm

    Let’s flip that question around; is there any special reason why they would implement such a thing?

    For one thing, it would be very, very expensive to compute the hash, making it all but useless for hash tables and the like. Just try to imagine doing this on a whole slew of 1920×1200 bitmaps; doing it even one time for each bitmap would slow the program to a crawl. I would expect that 9 times out of 10, when somebody has to compare two bitmaps, they want reference equality, not pixel-by-pixel value equality.

    And what you refer to in your question isn’t lazy evaluation, it’s caching. Caching is a non-trivial feature to implement, and every feature starts at minus 100 points.

    With all that in mind, my answer to this would be that the methods aren’t overridden because the overridden versions wouldn’t be particularly useful to many people, relative to the cost of implementing and maintaining such a feature. If you really want pixel-by-pixel comparisons (or checksums, or similar things), then you can always implement them yourself in 10 lines or so.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Paraphrasing from this MSDN documentation ... An INSERT statement is generated by the Entity
I have associated a file extension with my Delphi 2009 program. I have been
According to the MSDN documentation , transactional NTFS doesn't seem to allow one to
If I have 2 SmtpClient objects and I call SendAsync() method on both simultaneously,
It seems that these code snippets ought to behave identically: 1: Monitor.TryEnter(object) if (Monitor.TryEnter(lockObject))
It might seem natural to use Ctrl + + , Ctrl + - ,
I am trying to register a generic type in a config file for Unity
I would like to make some changes to my EF4 edmx file without modifying
I am working on a class that maintains a dictionary of images. This dictionary
I'm trying to use an invisible WebBrowser control to print a very simple HTML

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.