diff options
-rw-r--r-- | src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/Statics.cs | 2 | ||||
-rw-r--r-- | src/System.Private.CoreLib/shared/System/IO/PathHelper.Windows.cs | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/Statics.cs b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/Statics.cs index 3dc788350..0c2167213 100644 --- a/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/Statics.cs +++ b/src/System.Private.CoreLib/shared/System/Diagnostics/Tracing/TraceLogging/Statics.cs @@ -174,7 +174,7 @@ namespace System.Diagnostics.Tracing public static void CheckName(string name) { - if (name != null && name.Contains('\0')) + if (name != null && 0 <= name.IndexOf('\0')) { throw new ArgumentOutOfRangeException(nameof(name)); } diff --git a/src/System.Private.CoreLib/shared/System/IO/PathHelper.Windows.cs b/src/System.Private.CoreLib/shared/System/IO/PathHelper.Windows.cs index f9a649590..bada2f5cd 100644 --- a/src/System.Private.CoreLib/shared/System/IO/PathHelper.Windows.cs +++ b/src/System.Private.CoreLib/shared/System/IO/PathHelper.Windows.cs @@ -33,7 +33,7 @@ namespace System.IO // If we have the exact same string we were passed in, don't allocate another string. // TryExpandShortName does this input identity check. - string result = builder.AsSpan().Contains('~') + string result = builder.AsSpan().IndexOf('~') >= 0 ? TryExpandShortFileName(ref builder, originalPath: path) : builder.AsSpan().Equals(path.AsSpan(), StringComparison.Ordinal) ? path : builder.ToString(); @@ -56,7 +56,7 @@ namespace System.IO // Get the full path GetFullPathName(path.AsSpan(terminate: true), ref builder); - string result = builder.AsSpan().Contains('~') + string result = builder.AsSpan().IndexOf('~') >= 0 ? TryExpandShortFileName(ref builder, originalPath: null) : builder.ToString(); |