From 2cadd05bdc4d1f475ad9cc8230c0d206e2b18c41 Mon Sep 17 00:00:00 2001 From: Ahson Khan Date: Thu, 1 Mar 2018 12:23:01 -0800 Subject: Remove Span.NonGenerics and update leftover AsRoS -> AsSpan changes (#16689) Signed-off-by: dotnet-bot --- .../shared/System.Private.CoreLib.Shared.projitems | 1 - .../shared/System/IO/PathHelper.Windows.cs | 4 +-- .../shared/System/Span.NonGeneric.cs | 41 ---------------------- 3 files changed, 2 insertions(+), 44 deletions(-) delete mode 100644 src/System.Private.CoreLib/shared/System/Span.NonGeneric.cs (limited to 'src') diff --git a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems index fafe4b929..0b3f971b1 100644 --- a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems +++ b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems @@ -487,7 +487,6 @@ - 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 039a28834..74ceed10a 100644 --- a/src/System.Private.CoreLib/shared/System/IO/PathHelper.Windows.cs +++ b/src/System.Private.CoreLib/shared/System/IO/PathHelper.Windows.cs @@ -35,7 +35,7 @@ namespace System.IO // TryExpandShortName does this input identity check. string result = builder.AsSpan().Contains('~') ? TryExpandShortFileName(ref builder, originalPath: path) - : builder.AsSpan().Equals(path.AsReadOnlySpan()) ? path : builder.ToString(); + : builder.AsSpan().Equals(path.AsSpan()) ? path : builder.ToString(); // Clear the buffer builder.Dispose(); @@ -220,7 +220,7 @@ namespace System.IO // Strip out any added characters at the front of the string ReadOnlySpan output = builderToUse.AsSpan().Slice(rootDifference); - string returnValue = output.Equals(originalPath.AsReadOnlySpan()) + string returnValue = output.Equals(originalPath.AsSpan()) ? originalPath : new string(output); inputBuilder.Dispose(); diff --git a/src/System.Private.CoreLib/shared/System/Span.NonGeneric.cs b/src/System.Private.CoreLib/shared/System/Span.NonGeneric.cs deleted file mode 100644 index 4f2892d4c..000000000 --- a/src/System.Private.CoreLib/shared/System/Span.NonGeneric.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System.Diagnostics; -using System.Globalization; -using System.Runtime; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -using Internal.Runtime.CompilerServices; - -#if BIT64 -using nuint = System.UInt64; -#else -using nuint = System.UInt32; -#endif - -namespace System -{ - /// - /// Extension methods and non-generic helpers for Span, ReadOnlySpan, Memory, and ReadOnlyMemory. - /// - public static class Span - { - public static Span AsBytes(Span source) - where T : struct => source.AsBytes(); - - public static ReadOnlySpan AsBytes(ReadOnlySpan source) - where T : struct => source.AsBytes(); - - // TODO: Delete once the AsReadOnlySpan -> AsSpan rename propages through the system - public static ReadOnlySpan AsReadOnlySpan(this string text) => text.AsSpan(); - public static ReadOnlySpan AsReadOnlySpan(this string text, int start) => text.AsSpan(start); - public static ReadOnlySpan AsReadOnlySpan(this string text, int start, int length) => text.AsSpan(start, length); - - public static ReadOnlyMemory AsReadOnlyMemory(this string text) => text.AsMemory(); - public static ReadOnlyMemory AsReadOnlyMemory(this string text, int start) => text.AsMemory(start); - public static ReadOnlyMemory AsReadOnlyMemory(this string text, int start, int length) => text.AsMemory(start, length); - } -} -- cgit v1.2.3