Collapse AsSpan().Slice(..) into AsSpan(..) (#1991)

This commit is contained in:
Ahson Khan 2018-04-12 23:15:47 -07:00 committed by David Fowler
parent 16c6a65bf2
commit 0ee4a86564
2 changed files with 3 additions and 3 deletions

View File

@ -288,7 +288,7 @@ namespace Microsoft.AspNetCore.Internal
#if NETCOREAPP2_1
public override void Write(ReadOnlySpan<byte> span)
{
if (_currentSegment != null && span.TryCopyTo(_currentSegment.AsSpan().Slice(_position)))
if (_currentSegment != null && span.TryCopyTo(_currentSegment.AsSpan(_position)))
{
_position += span.Length;
_bytesWritten += span.Length;

View File

@ -107,7 +107,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
var result = await ws.ReceiveAsync(buffer, CancellationToken.None).OrTimeout();
logger.LogInformation("Received {length} byte frame", result.Count);
Assert.Equal(bytes, buffer.Array.AsSpan().Slice(0, result.Count).ToArray());
Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray());
logger.LogInformation("Closing socket");
await ws.CloseOutputAsync(WebSocketCloseStatus.Empty, "", CancellationToken.None).OrTimeout();
@ -145,7 +145,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
var result = await ws.ReceiveAsync(buffer, CancellationToken.None).OrTimeout();
logger.LogInformation("Received {length} byte frame", result.Count);
Assert.Equal(bytes, buffer.Array.AsSpan().Slice(0, result.Count).ToArray());
Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray());
logger.LogInformation("Closing socket");
await ws.CloseOutputAsync(WebSocketCloseStatus.Empty, "", CancellationToken.None).OrTimeout();