Archive for category Internals

In defence of C# (null <= null)

I read a funny remark on ‘null’ comparison recently which at first glance seems to be surprising, but uppon further investigation becomes understandable. The following program demonstrates: The output of the program: False True How can the ‘Less than or equal’ operator be false, when it has the same value on both sides? And why […]

Leave a comment

Do experts use ++i?

Not so long ago I’ve read a note in a blog comment. It said that experts above a certain level should write their for-loop as the following: The important part is the ++i. Why is this better? A vast majority of developers use i++, I haven’t any idea as to why. I use i++, too, […]

2 Comments

What does Object.GetHashCode() return?

There are some misconceptions about Object.GetHashCode(). Two of them are quite prevalent: The implementation of Object.GetHashCode() derives the hash value from the reference (as a memory pointer value) of the instance The return value of Object.GetHashCode() is unique to the instance. No other instances will have the same hash value. These two claims may look […]

1 Comment