-
Notifications
You must be signed in to change notification settings - Fork 592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use == and != for string comparisons in C# #1746
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
@@ -56,57 +56,57 @@ internal static void twoways(global::Test.TestHelper helper, Test.MyClassPrx p) | |||
Ice.Communicator communicator = helper.communicator(); | |||
string[] literals = p.opStringLiterals(); | |||
|
|||
test(Test.s0.value.Equals("\\") && | |||
test(Test.s0.value == "\\" && | |||
Test.s0.value.Equals(Test.sw0.value) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we use ==
in all the other comparisons in the && conditions?
test(properties.getProperty("Ice.Trace.Network") == "1"); | ||
test(properties.getProperty("Ice.Trace.Protocol") == "1"); | ||
test(properties.getProperty("Config.Path") == "./config/中国_client.config"); | ||
test(properties.getProperty("Ice.ProgramName") == "PropertiesClient"); | ||
test(appName().Equals(properties.getProperty("Ice.ProgramName"))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
appName()
returns a string too, doesn't it?
test(properties.getProperty("Ice.ProgramName") == appName());
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it was an automatic update. There are many more Equals that can be replaced by ==
This PR replaces .Equals by == or != for string comparisons in C#.
It also replaces "" comparisons by Length comparisons (0 or > 0).