Possible Duplicate:
Are string.Equals() and == operator really same?
I know that in c# you can compare string with == and equals but I want to know what is that I need to use according to best practices. Note that I need to know if it’s the same for String and string
Stringandstringare exactly the same in C#. The “best practice” would be identical.Whether to use
==orEquals, in the case of string, is somewhat personal preference. I personally prefer==, as its a bit more readable (in my opinion) and far shorter to type.