Skip to content

Commit e428f13

Browse files
authored
Emphasise further the possibly-unexpected default behaviour of StringComparison (#8989)
1 parent 8bbf303 commit e428f13

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

xml/System/String.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5074,7 +5074,7 @@ This method performs an ordinal (case-sensitive and culture-insensitive) compari
50745074
<exception cref="T:System.ArgumentNullException">
50755075
<paramref name="value" /> is <see langword="null" />.</exception>
50765076
<block subset="none" type="usage">
5077-
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To determine whether a string ends with a particular substring by using the string comparison rules of the current culture, call the <see cref="M:System.String.EndsWith(System.String,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its <paramref name="comparisonType" /> parameter.</para>
5077+
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To determine whether a string ends with a particular substring by using the string comparison rules of the current culture, signal your intention explicitly by calling the <see cref="M:System.String.EndsWith(System.String,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its <paramref name="comparisonType" /> parameter.</para>
50785078
</block>
50795079
<altmember cref="M:System.String.StartsWith(System.String)" />
50805080
<altmember cref="M:System.String.Compare(System.String,System.String)" />
@@ -7579,7 +7579,7 @@ The `GetPinnableReference` method returns a character that can be used for pinni
75797579
<exception cref="T:System.ArgumentNullException">
75807580
<paramref name="value" /> is <see langword="null" />.</exception>
75817581
<block subset="none" type="usage">
7582-
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To find the first index of a substring within a string instance by using the comparison rules of the current culture, call the <see cref="M:System.String.IndexOf(System.String,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its `comparisonType` parameter.</para>
7582+
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To find the first index of a substring within a string instance by using the comparison rules of the current culture, signal your intention explicitly by calling the <see cref="M:System.String.IndexOf(System.String,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its `comparisonType` parameter.</para>
75837583
</block>
75847584
<altmember cref="T:System.Int32" />
75857585
<altmember cref="T:System.Globalization.CultureInfo" />
@@ -7795,7 +7795,7 @@ The `comparisonType` parameter is a <xref:System.StringComparison> enumeration m
77957795
<exception cref="T:System.ArgumentOutOfRangeException">
77967796
<paramref name="startIndex" /> is less than 0 (zero) or greater than the length of this string.</exception>
77977797
<block subset="none" type="usage">
7798-
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To find the first index of a substring that occurs after a particular character position by using the comparison rules of the current culture, call the <see cref="M:System.String.IndexOf(System.String,System.Int32,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its `comparisonType` parameter.</para>
7798+
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To find the first index of a substring that occurs after a particular character position by using the comparison rules of the current culture, signal your intention explicitly by calling the <see cref="M:System.String.IndexOf(System.String,System.Int32,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its `comparisonType` parameter.</para>
77997799
</block>
78007800
<altmember cref="T:System.Int32" />
78017801
<altmember cref="T:System.Globalization.CultureInfo" />
@@ -8067,7 +8067,7 @@ The `comparisonType` parameter is a <xref:System.StringComparison> enumeration m
80678067

80688068
<paramref name="count" /> is greater than the length of this string minus <paramref name="startIndex" />.</exception>
80698069
<block subset="none" type="usage">
8070-
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To use the comparison rules of the current culture to perform this operation, call the <see cref="M:System.String.IndexOf(System.String,System.Int32,System.Int32,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its `comparisonType` parameter.</para>
8070+
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To use the comparison rules of the current culture to perform this operation, signal your intention explicitly by calling the <see cref="M:System.String.IndexOf(System.String,System.Int32,System.Int32,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its `comparisonType` parameter.</para>
80718071
</block>
80728072
<altmember cref="T:System.Int32" />
80738073
<altmember cref="T:System.Globalization.CultureInfo" />
@@ -9970,7 +9970,7 @@ In the following example, the <xref:System.String.LastIndexOf%28System.String%29
99709970
<exception cref="T:System.ArgumentNullException">
99719971
<paramref name="value" /> is <see langword="null" />.</exception>
99729972
<block subset="none" type="usage">
9973-
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To find the last index of a substring within a string instance by using the comparison rules of the current culture, call the <see cref="M:System.String.LastIndexOf(System.String,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its <paramref name="comparisonType" /> parameter.</para>
9973+
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To find the last index of a substring within a string instance by using the comparison rules of the current culture, signal your intention explicitly by calling the <see cref="M:System.String.LastIndexOf(System.String,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its <paramref name="comparisonType" /> parameter.</para>
99749974
</block>
99759975
<altmember cref="T:System.Int32" />
99769976
<altmember cref="M:System.String.IndexOf(System.Char)" />
@@ -10130,7 +10130,7 @@ In the following example, the <xref:System.String.LastIndexOf%28System.String%29
1013010130

1013110131
The current instance equals <see cref="F:System.String.Empty" />, and <paramref name="startIndex" /> is less than -1 or greater than zero.</exception>
1013210132
<block subset="none" type="usage">
10133-
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To find the index of a substring that precedes a particular character position by using the comparison rules of the current culture, call the <see cref="M:System.String.LastIndexOf(System.String,System.Int32,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its <paramref name="comparisonType" /> parameter.</para>
10133+
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To find the index of a substring that precedes a particular character position by using the comparison rules of the current culture, signal your intention explicitly by calling the <see cref="M:System.String.LastIndexOf(System.String,System.Int32,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its <paramref name="comparisonType" /> parameter.</para>
1013410134
</block>
1013510135
<altmember cref="T:System.Int32" />
1013610136
<altmember cref="M:System.String.IndexOf(System.Char)" />
@@ -10419,7 +10419,7 @@ In the following example, the <xref:System.String.LastIndexOf%2A> method is used
1041910419

1042010420
The current instance equals <see cref="F:System.String.Empty" /> and <paramref name="count" /> is greater than 1.</exception>
1042110421
<block subset="none" type="usage">
10422-
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To perform this operation by using the comparison rules of the current culture, call the <see cref="M:System.String.LastIndexOf(System.String,System.Int32,System.Int32,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its <paramref name="comparisonType" /> parameter.</para>
10422+
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To perform this operation by using the comparison rules of the current culture, signal your intention explicitly by calling the <see cref="M:System.String.LastIndexOf(System.String,System.Int32,System.Int32,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its <paramref name="comparisonType" /> parameter.</para>
1042310423
</block>
1042410424
<altmember cref="T:System.Int32" />
1042510425
<altmember cref="M:System.String.IndexOf(System.Char)" />
@@ -13296,7 +13296,7 @@ The following example defines a `StripStartTags` method that uses the <xref:Syst
1329613296
<exception cref="T:System.ArgumentNullException">
1329713297
<paramref name="value" /> is <see langword="null" />.</exception>
1329813298
<block subset="none" type="usage">
13299-
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To determine whether a string begins with a particular substring by using the string comparison rules of the current culture, call the <see cref="M:System.String.StartsWith(System.String,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its <paramref name="comparisonType" /> parameter.</para>
13299+
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string comparison methods that substitute default values and instead call methods that require parameters to be explicitly specified. To determine whether a string begins with a particular substring by using the string comparison rules of the current culture, signal your intention explicitly by calling the <see cref="M:System.String.StartsWith(System.String,System.StringComparison)" /> method overload with a value of <see cref="F:System.StringComparison.CurrentCulture" /> for its <paramref name="comparisonType" /> parameter.</para>
1330013300
</block>
1330113301
<altmember cref="M:System.String.EndsWith(System.String)" />
1330213302
</Docs>
@@ -15313,7 +15313,7 @@ This member is an explicit interface member implementation. It can be used only
1531315313
]]></format>
1531415314
</remarks>
1531515315
<block subset="none" type="usage">
15316-
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string casing methods that substitute default values and instead call methods that require parameters to be explicitly specified. To convert a character to lowercase by using the casing conventions of the current culture, call the <see cref="M:System.String.ToLower(System.Globalization.CultureInfo)" /> method overload with a value of <see cref="P:System.Globalization.CultureInfo.CurrentCulture" /> for its <paramref name="culture" /> parameter.</para>
15316+
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string casing methods that substitute default values and instead call methods that require parameters to be explicitly specified. To convert a character to lowercase by using the casing conventions of the current culture, signal your intention explicitly by calling the <see cref="M:System.String.ToLower(System.Globalization.CultureInfo)" /> method overload with a value of <see cref="P:System.Globalization.CultureInfo.CurrentCulture" /> for its <paramref name="culture" /> parameter.</para>
1531715317
</block>
1531815318
<altmember cref="M:System.String.ToLowerInvariant" />
1531915319
<altmember cref="M:System.String.ToUpper" />
@@ -15688,7 +15688,7 @@ This member is an explicit interface member implementation. It can be used only
1568815688
]]></format>
1568915689
</remarks>
1569015690
<block subset="none" type="usage">
15691-
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string casing methods that substitute default values and instead call methods that require parameters to be explicitly specified. To convert a string to uppercase by using the casing conventions of the current culture, call the <see cref="M:System.String.ToUpper(System.Globalization.CultureInfo)" /> method overload with a value of <see cref="P:System.Globalization.CultureInfo.CurrentCulture" /> for its <paramref name="culture" /> parameter.</para>
15691+
<para>As explained in [Best Practices for Using Strings](/dotnet/standard/base-types/best-practices-strings), we recommend that you avoid calling string casing methods that substitute default values and instead call methods that require parameters to be explicitly specified. To convert a string to uppercase by using the casing conventions of the current culture, signal your intention explicitly by calling the <see cref="M:System.String.ToUpper(System.Globalization.CultureInfo)" /> method overload with a value of <see cref="P:System.Globalization.CultureInfo.CurrentCulture" /> for its <paramref name="culture" /> parameter.</para>
1569215692
</block>
1569315693
<altmember cref="M:System.String.ToLower" />
1569415694
<altmember cref="M:System.String.ToLowerInvariant" />

0 commit comments

Comments
 (0)