KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In some languages (e.g. C++) you can't use operators like == for string comparisons as that would compare the address of the string object, and not the string itself. However, in C# you can use == to compare strings, and it will actually compare the content of the strings. But there are also string functions to handle such comparisons, so my question is; should you? Given two strings: string aa = "aa"; string bb = "bb"; Should you compare them like this: bool areEqual = (aa == bb); Or should you use the Equal function, like this: bool areEqual = aa.Equals(bb); Is there any technical difference anyway? Or reasonable arguments for best practice?
Tags (comma-separated)
Save Edits
Cancel