diff options
Diffstat (limited to 'src/System.Private.CoreLib/shared')
3 files changed, 6 insertions, 6 deletions
diff --git a/src/System.Private.CoreLib/shared/System/IO/FileStream.Unix.cs b/src/System.Private.CoreLib/shared/System/IO/FileStream.Unix.cs index 5f3c55e227..fc291340d7 100644 --- a/src/System.Private.CoreLib/shared/System/IO/FileStream.Unix.cs +++ b/src/System.Private.CoreLib/shared/System/IO/FileStream.Unix.cs @@ -597,13 +597,13 @@ namespace System.IO int spaceRemaining = _bufferLength - _writePos; if (spaceRemaining >= source.Length) { - source.CopyTo(new Span<byte>(GetBuffer()).Slice(_writePos)); + source.CopyTo(GetBuffer().AsSpan(_writePos)); _writePos += source.Length; return; } else if (spaceRemaining > 0) { - source.Slice(0, spaceRemaining).CopyTo(new Span<byte>(GetBuffer()).Slice(_writePos)); + source.Slice(0, spaceRemaining).CopyTo(GetBuffer().AsSpan(_writePos)); _writePos += spaceRemaining; source = source.Slice(spaceRemaining); } diff --git a/src/System.Private.CoreLib/shared/System/IO/FileStream.Windows.cs b/src/System.Private.CoreLib/shared/System/IO/FileStream.Windows.cs index 91612dc47f..f7592282c0 100644 --- a/src/System.Private.CoreLib/shared/System/IO/FileStream.Windows.cs +++ b/src/System.Private.CoreLib/shared/System/IO/FileStream.Windows.cs @@ -661,13 +661,13 @@ namespace System.IO { if (numBytes >= source.Length) { - source.CopyTo(new Span<byte>(GetBuffer()).Slice(_writePos)); + source.CopyTo(GetBuffer().AsSpan(_writePos)); _writePos += source.Length; return; } else { - source.Slice(0, numBytes).CopyTo(new Span<byte>(GetBuffer()).Slice(_writePos)); + source.Slice(0, numBytes).CopyTo(GetBuffer().AsSpan(_writePos)); _writePos += numBytes; source = source.Slice(numBytes); } @@ -692,7 +692,7 @@ namespace System.IO } // Copy remaining bytes into buffer, to write at a later date. - source.CopyTo(new Span<byte>(GetBuffer()).Slice(_writePos)); + source.CopyTo(GetBuffer().AsSpan(_writePos)); _writePos = source.Length; return; } diff --git a/src/System.Private.CoreLib/shared/System/IO/UnmanagedMemoryStream.cs b/src/System.Private.CoreLib/shared/System/IO/UnmanagedMemoryStream.cs index d4af4cfee3..8ebf606627 100644 --- a/src/System.Private.CoreLib/shared/System/IO/UnmanagedMemoryStream.cs +++ b/src/System.Private.CoreLib/shared/System/IO/UnmanagedMemoryStream.cs @@ -656,7 +656,7 @@ namespace System.IO if (buffer.Length - offset < count) throw new ArgumentException(SR.Argument_InvalidOffLen); - WriteCore(new Span<byte>(buffer, offset, count)); + WriteCore(new ReadOnlySpan<byte>(buffer, offset, count)); } public override void Write(ReadOnlySpan<byte> buffer) |