r/programming • • Jun 27 '10

Why Java Sucks and C# Rocks (Final)

http://www.slideshare.net/jeffz/why-java-sucks-and-c-rocks-final
13 Upvotes

197 comments sorted by

View all comments

Show parent comments

1

u/[deleted] Jun 28 '10

While C# is better than Java, you can still run into traps because == sometimes means value-equality and sometimes means reference quality. I prefer it when they use separate operators.

1

u/recursive Jun 30 '10

you can always use .ReferenceEquals() if you want it.

1

u/[deleted] Jun 30 '10

Yea, but if I did everyone would think I was crazy. It is like the lunatics who insist on writing String.Empty instead of "".

1

u/locuester Jul 08 '10

Why do they do that?! It drives me nuts.

1

u/[deleted] Jul 08 '10

Because they have never used a switch block before?

The best argument I have against String.Empty is that it isn't a constant. That means the compiler can't do certain optimizations that it could otherwise do. That especially means you can't use String.Empty anywhere where a constant is needed such as switch blocks or optional parameters.

But this still doesn't answer the reason why?