Skip to content

Conversation

danmoseley
Copy link
Member

Summary

Clarify that String.Contains(char) uses Ordinal comparison. (This may be assumed to most, but it clarifies when one needs to use String.Contains(char, StringComparison).

Note that the extension method version of String.Contains(string, StringComparison) is only relevant to .NET Framework. The method is included in .NET Core.

@dotnet-bot dotnet-bot added this to the May 2020 milestone May 17, 2020
@danmoseley danmoseley requested a review from pgovind May 17, 2020 02:33
<returns>
<see langword="true" /> if the <paramref name="value" /> parameter occurs within this string; otherwise, <see langword="false" />.</returns>
<remarks>To be added.</remarks>
<remarks>
Copy link

@pgovind pgovind May 17, 2020

Choose a reason for hiding this comment

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

My understanding is that remarks don't show in intellisense. If we want this to show up in VS, we should move this change up into the summary. I'm happy with the text itself though :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Just copying Contains (string value). @BillWagner ?

Copy link
Member Author

Choose a reason for hiding this comment

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

@BillWagner could you help with that question?

This method performs an ordinal (case-sensitive and culture-insensitive) comparison. The search begins at the first character position of this string and continues through the last character position.

To determine whether a string contains a specified substring by using something other than ordinal comparison (such as culture-sensitive comparison, or ordinal case-insensitive comparison), you can create a custom method. The following example illustrates one such approach. It defines a <xref:System.String> extension method that includes a <xref:System.StringComparison> parameter and indicates whether a string contains a substring when using the specified form of string comparison.
**.NET Framework only**: To determine whether a string contains a specified substring by using something other than ordinal comparison (such as culture-sensitive comparison, or ordinal case-insensitive comparison), you can create a custom method. The following example illustrates one such approach. It defines a <xref:System.String> extension method that includes a <xref:System.StringComparison> parameter and indicates whether a string contains a substring when using the specified form of string comparison.
Copy link

Choose a reason for hiding this comment

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

Does writing .NET Framework only at the beginning make it seem like the ability exists only in .NET Framework and not in .NET core(when it actually does)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not sure, I just copied this pattern. I defer to docs folks.

@danmoseley
Copy link
Member Author

@pgovind since the questions above relate to the existing doc, perhaps it would make sense to merge this as is?

@pgovind
Copy link

pgovind commented Jun 17, 2020

@pgovind since the questions above relate to the existing doc, perhaps it would make sense to merge this as is?

Agreed. Approved

@danmoseley danmoseley merged commit ababeae into dotnet:master Jun 17, 2020
@danmoseley danmoseley deleted the containschar branch June 17, 2020 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants