Skip to content

Expand warnings in compare-strings.md - #35171

Merged
BillWagner merged 2 commits into
dotnet:mainfrom
Smaug123:patch-2
May 2, 2023
Merged

BillWagner merged 2 commits into
dotnet:mainfrom
Smaug123:patch-2

Conversation

@Smaug123

@Smaug123 Smaug123 commented Apr 26, 2023 •

Copy link
Copy Markdown
Contributor

Summary

Add two sentences in the "Linguistic Comparison" section of the "How to compare strings" documentation, noting that this is in fact the default behaviour for many methods and noting one particularly common way people discover this fact as having created a bug in their code.

(Related to #35069; raised off the back of dotnet/dotnet-api-docs#8973 .)


Internal previews

📄 File 🔗 Preview link
docs/csharp/how-to/compare-strings.md How to compare strings in C#

@Smaug123
Smaug123 requested a review from BillWagner as a code owner April 26, 2023 20:45
@dotnet-bot dotnet-bot added this to the April 2023 milestone Apr 26, 2023
@ghost ghost added the community-contribution Indicates PR is created by someone from the .NET community. label Apr 26, 2023
@Smaug123

Copy link
Copy Markdown
Contributor Author

(Can I see the problem with the OpenPublishing.Build pipeline?)

@MSDN-WhiteKnight

Copy link
Copy Markdown
Contributor

This change seems too vague. Instead of stating that "many" methods default to current culture, it's better to link to existing article that lists them: https://learn.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings#string-comparisons-that-use-the-current-culture

Also "unless overridden" is not really a correct term to use here. You probable meant something like "unless another string comparison option is passed explicitly"?

@Smaug123

Copy link
Copy Markdown
Contributor Author

How about "Many methods" but hyperlinked to the page you suggest?

I'm not sure what one does to a default other than override it or accept it, but sure, I'm happy to be more verbose here if you like.

@MSDN-WhiteKnight

Copy link
Copy Markdown
Contributor

How about "Many methods" but hyperlinked to the page you suggest?

Seems fine to me

I'm not sure what one does to a default other than override it or accept it, but sure, I'm happy to be more verbose here if you like.

The issue is that "overriding a method" in .NET typically refers to adding a virtual method implementation in derived class. It don't have to be verbose, but it's best not to use terms in confusing way.

@BillWagner

Copy link
Copy Markdown
Member

(Can I see the problem with the OpenPublishing.Build pipeline?)

This is an enhancement we've requested. At this time, no. It's behind an AAD firewall.

In this instance, it was a problem allocating build resources. Closing and reopening to force a new build.

@BillWagner BillWagner closed this Apr 27, 2023
@BillWagner BillWagner reopened this Apr 27, 2023

@BillWagner BillWagner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @Smaug123 This is a good addition. I had a suggestion on wording. Once we resolve that discussion, this is ready to merge.

Comment thread docs/csharp/how-to/compare-strings.md Resolved
@Smaug123

Copy link
Copy Markdown
Contributor Author

Ah, I had forgotten that override is a language keyword. (I come from F# where virtual members are extremely rare - I'm actually not sure I've ever knowingly seen one!)

@BillWagner BillWagner self-assigned this May 1, 2023
@BillWagner
BillWagner enabled auto-merge (squash) May 2, 2023 13:42
@BillWagner
BillWagner disabled auto-merge May 2, 2023 14:20
@BillWagner
BillWagner merged commit a4cd5b3 into dotnet:main May 2, 2023
@Smaug123
Smaug123 deleted the patch-2 branch May 3, 2023 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Indicates PR is created by someone from the .NET community. dotnet-csharp/svc fundamentals/subsvc

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants