Skip to content

Commit cae5cef

Browse files
authored
Use string.Equals over string.Compare for improved performance (#9724)
1 parent 0d959af commit cae5cef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/ContentType.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,8 +258,8 @@ internal bool AreTypeAndSubTypeEqual(ContentType contentType, bool allowParamete
258258
// safe comparison because the _type and _subType strings have been restricted to
259259
// ASCII characters, digits, and a small set of symbols. This is not a safe comparison
260260
// for the broader set of strings that have not been restricted in the same way.
261-
result = (String.Compare(_type, contentType.TypeComponent, StringComparison.OrdinalIgnoreCase) == 0 &&
262-
String.Compare(_subType, contentType.SubTypeComponent, StringComparison.OrdinalIgnoreCase) == 0);
261+
result = string.Equals(_type, contentType.TypeComponent, StringComparison.OrdinalIgnoreCase) &&
262+
string.Equals(_subType, contentType.SubTypeComponent, StringComparison.OrdinalIgnoreCase);
263263
}
264264
return result;
265265
}

0 commit comments

Comments
 (0)