0

In Java when we use == operator in the context of strings we actually compare references not values (if I understand it correctly). Because of that it's strongly recommend to use equals method.

Is the situation in C# analogous to Java? Should I avoid comparing strings with == operator? How to do strings comparsion properly? What is the catch and in what situations I can get something I didn't expect?

user3616181
  • 975
  • 2
  • 8
  • 27
  • 1
    and http://stackoverflow.com/questions/814878/c-sharp-difference-between-and-equals – Habib Oct 20 '14 at 17:48
  • string overloads the == operator [source here](http://referencesource.microsoft.com/#mscorlib/system/string.cs.html) – RadioSpace Oct 20 '14 at 18:05

0 Answers0