Skip to content

Conversation

@iSazonov
Copy link
Collaborator

@iSazonov iSazonov commented Oct 18, 2018

PR Summary

Related #8064

Replace StringComparision.CurrentCulture with StringComparision.Ordinal.

Best Practices for Using Strings in .NET

Not all code base is fixed. There are not obvious cases.

PR Checklist


This change is Reviewable

@iSazonov iSazonov added the Issue-Code Cleanup the issue is for cleaning up the code with no impact on functionality label Oct 18, 2018
@iSazonov iSazonov self-assigned this Oct 18, 2018
@TravisEz13
Copy link
Member


src/Microsoft.WSMan.Management/WSManConnections.cs, line 143 at r1 (raw file):

            {
                computername = value;
                if ((string.IsNullOrEmpty(computername)) || (computername.Equals(".", StringComparison.OrdinalIgnoreCase)))

I've seen this in many places, perhaps we should have a central place for this code?

Copy link
Member

@TravisEz13 TravisEz13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 24 of 24 files at r1.
Reviewable status: :shipit: complete! all files reviewed

@TravisEz13
Copy link
Member

We probably should fix this one as well:

Hashtable hashtable = new Hashtable(StringComparer.CurrentCultureIgnoreCase);

@TravisEz13
Copy link
Member

Thinking about it further with @JamesWTruher , Hashtable could be culture sensitive in some cases. This should be a different PR and probably be behind an experimental flag.

@iSazonov
Copy link
Collaborator Author

Hashtable could be culture sensitive in some cases.

@TravisEz13 In the PR I fixed only obvious cases. There are still about 30 unclear cases left. It would be great if MSFT team reviewed them.

I've seen this in many places, perhaps we should have a central place for this code?

If we should please open a tracking issue and I'll fix this later.

@iSazonov iSazonov merged commit 0a4f33a into PowerShell:master Oct 21, 2018
@iSazonov iSazonov deleted the cleanup-culture branch October 21, 2018 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue-Code Cleanup the issue is for cleaning up the code with no impact on functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants