Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit b3957a3

Browse files
cincuranetstephentoub
authored andcommitted
Simpler code (same as in String.Manipulation.cs). (#15223)
1 parent 5ae97a6 commit b3957a3

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

src/mscorlib/src/System/String.Comparison.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -798,12 +798,7 @@ public Boolean EndsWith(String value, Boolean ignoreCase, CultureInfo culture)
798798
return true;
799799
}
800800

801-
CultureInfo referenceCulture;
802-
if (culture == null)
803-
referenceCulture = CultureInfo.CurrentCulture;
804-
else
805-
referenceCulture = culture;
806-
801+
CultureInfo referenceCulture = culture ?? CultureInfo.CurrentCulture;
807802
return referenceCulture.CompareInfo.IsSuffix(this, value, ignoreCase ? CompareOptions.IgnoreCase : CompareOptions.None);
808803
}
809804

@@ -1134,12 +1129,7 @@ public Boolean StartsWith(String value, Boolean ignoreCase, CultureInfo culture)
11341129
return true;
11351130
}
11361131

1137-
CultureInfo referenceCulture;
1138-
if (culture == null)
1139-
referenceCulture = CultureInfo.CurrentCulture;
1140-
else
1141-
referenceCulture = culture;
1142-
1132+
CultureInfo referenceCulture = culture ?? CultureInfo.CurrentCulture;
11431133
return referenceCulture.CompareInfo.IsPrefix(this, value, ignoreCase ? CompareOptions.IgnoreCase : CompareOptions.None);
11441134
}
11451135

0 commit comments

Comments
 (0)