4 ms·
I've been writing apps in C# for about 5 years, and not once have I needed to know how GetHashCode works. I have looked at it at some point (don't remember why
by atonse 12y ago
I've been writing apps in C# for about 5 years, and not once have I needed to know how GetHashCode works.
I have looked at it at some point (don't remember why, I think it had to do with an entity's identity for NHibernate) but I would fail this question even though most people I've worked with would rate me as a very effective (and efficient) programmer.
This is why I feel I would do badly in these kinds of trivia-like interviews (once since I put linux administration on my resume, I was asked how to delimit lines in bash scripting).
My dream interview, one where I'd shine, is where I'm given a problem, and I have to go through designing solutions and discussing tradeoffs. I don't mind writing code either, but I would not know the answer to this kind of very specific question, I'd just know how to solve problems.
- barrkel 12y agoHave you never written a class that you wanted to use as a key in a dictionary? You need to know the contract of GetHashCode to do this properly. If you don't know the contract of GetHashCode, well, you simply don't know .NET very well. That's my professional opinion.
- scintill76 12y agoI don't know much C#, but can't one understand the contract without knowing the default implementation? I would agree understanding the contract is probably essential, but the implementation is not.