965 references to AsSpan
Aspire.Hosting (1)
Utils\HashDigestStream.cs (1)
26_hashAlgorithm.Append(buffer.AsSpan(offset, count));
Aspire.Hosting.Docker (1)
EnvVarEscaper.cs (1)
225var strippedSpan = stripped.AsSpan(0, strippedLength);
dotnet (4)
Commands\Test\MTP\IPC\ProtocolMessageSerializer.cs (3)
45if (!BitConverter.TryWriteBytes(frame.AsSpan(0, sizeof(int)), payloadLength) || 46!BitConverter.TryWriteBytes(frame.AsSpan(sizeof(int), sizeof(int)), serializer.Id)) 51body.GetBuffer().AsSpan(0, (int)body.Length).CopyTo(frame.AsSpan(FrameHeaderSize));
Commands\Test\MTP\TestResultsDirectoryResolver.cs (1)
306return Convert.ToHexString(hash.AsSpan(0, 8)).ToLowerInvariant();
GenerateDocumentationAndConfigFiles (7)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
356=> GetFNVHashCode(text.AsSpan(start, length));
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (1)
120=> Add(chars.AsSpan(start, len));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
194_concatenatedLowerCaseWords.AsSpan(currentNode.CharacterSpan.Start, currentNode.CharacterSpan.Length), 195_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
120_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (1)
97_sourceLowerCaseCharacters.AsSpan(0, _source.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
98: rentedArray.AsSpan(0, decodedLength);
ILCompiler.Compiler (7)
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\SectionData.cs (1)
127return Read(buffer.AsSpan(offset, count));
src\runtime\src\coreclr\tools\Common\Internal\Text\Utf8StringBuilder.cs (1)
26public ReadOnlySpan<byte> AsSpan() => _buffer.AsSpan(0, _length);
src\runtime\src\coreclr\tools\Common\Pgo\PgoFormat.cs (2)
167signedInt = BinaryPrimitives.ReadInt64BigEndian(bytes.AsSpan(offset + 1, sizeof(long))); 172signedInt = BinaryPrimitives.ReadInt32BigEndian(bytes.AsSpan(offset + 1, sizeof(int)));
src\runtime\src\coreclr\tools\Common\System\Collections\Generic\ArrayBuilder.cs (3)
49public readonly Span<T> AsSpan() => _items.AsSpan(0, _count); 51public readonly Span<T> AsSpan(int start) => _items.AsSpan(start, _count - start); 59return _items.AsSpan(origCount, length);
ILCompiler.Diagnostics (6)
PerfMapWriter.cs (6)
87if (!BitConverter.TryWriteBytes(buffer.AsSpan(0, sizeof(uint)), (uint)targetTokens.OperatingSystem) 88|| !BitConverter.TryWriteBytes(buffer.AsSpan(4, sizeof(uint)), (uint)targetTokens.Architecture) 89|| !BitConverter.TryWriteBytes(buffer.AsSpan(8, sizeof(uint)), (uint)targetTokens.Abi)) 96buffer.AsSpan(0, sizeof(uint)).Reverse(); 97buffer.AsSpan(4, sizeof(uint)).Reverse(); 98buffer.AsSpan(8, sizeof(uint)).Reverse();
ILCompiler.ReadyToRun (10)
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\SectionData.cs (1)
127return Read(buffer.AsSpan(offset, count));
src\runtime\src\coreclr\tools\Common\Compiler\ObjectWriter\WebCilObjectWriter.cs (3)
532src.GetBuffer().AsSpan((int)srcPos, (int)count).CopyTo(dest.GetBuffer().AsSpan((int)destPos, (int)count)); 843Span<byte> relocContents = buffer.AsSpan(0, Relocation.GetSize(reloc.Type));
src\runtime\src\coreclr\tools\Common\Internal\Text\Utf8StringBuilder.cs (1)
26public ReadOnlySpan<byte> AsSpan() => _buffer.AsSpan(0, _length);
src\runtime\src\coreclr\tools\Common\Pgo\PgoFormat.cs (2)
167signedInt = BinaryPrimitives.ReadInt64BigEndian(bytes.AsSpan(offset + 1, sizeof(long))); 172signedInt = BinaryPrimitives.ReadInt32BigEndian(bytes.AsSpan(offset + 1, sizeof(int)));
src\runtime\src\coreclr\tools\Common\System\Collections\Generic\ArrayBuilder.cs (3)
49public readonly Span<T> AsSpan() => _items.AsSpan(0, _count); 51public readonly Span<T> AsSpan(int start) => _items.AsSpan(start, _count - start); 59return _items.AsSpan(origCount, length);
ILCompiler.RyuJit (4)
JitInterface\CorInfoImpl.RyuJit.cs (1)
2393bytes.AsSpan(valueOffset, bufferSize).CopyTo(new Span<byte>(buffer, bufferSize));
src\runtime\src\coreclr\tools\Common\System\Collections\Generic\ArrayBuilder.cs (3)
49public readonly Span<T> AsSpan() => _items.AsSpan(0, _count); 51public readonly Span<T> AsSpan(int start) => _items.AsSpan(start, _count - start); 59return _items.AsSpan(origCount, length);
ILCompiler.TypeSystem (10)
src\runtime\src\coreclr\tools\Common\System\Collections\Generic\ArrayBuilder.cs (3)
49public readonly Span<T> AsSpan() => _items.AsSpan(0, _count); 51public readonly Span<T> AsSpan(int start) => _items.AsSpan(start, _count - start); 59return _items.AsSpan(origCount, length);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILDisassembler.cs (3)
195ushort val = BinaryPrimitives.ReadUInt16LittleEndian(_ilBytes.AsSpan(_currentOffset, sizeof(ushort))); 202uint val = BinaryPrimitives.ReadUInt32LittleEndian(_ilBytes.AsSpan(_currentOffset, sizeof(uint))); 215ulong value = BinaryPrimitives.ReadUInt64LittleEndian(_ilBytes.AsSpan(_currentOffset, sizeof(ulong)));
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\ILTokenReplacer.cs (1)
27var tokenSpan = ilStream.AsSpan(checked(offsetAfter - 4), 4);
src\runtime\src\coreclr\tools\Common\TypeSystem\IL\Stubs\ILEmitter.cs (3)
63BinaryPrimitives.WriteUInt16LittleEndian(_instructions.AsSpan(_length, sizeof(ushort)), value); 72BinaryPrimitives.WriteInt32LittleEndian(_instructions.AsSpan(_length, sizeof(int)), value); 482Span<byte> offsetSpan = _instructions.AsSpan(patch.Offset, sizeof(int));
Microsoft.AspNetCore.Antiforgery (4)
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (1)
160var previousBuffer = oldBuffer.AsSpan(0, _index);
src\aspnetcore\src\Shared\WebEncoders\WebEncoders.cs (3)
172Span<char> bufferSpan = buffer.AsSpan(i, count); 287return Base64UrlEncode(input.AsSpan(offset, count)); 342return Base64UrlEncode(input.AsSpan(offset, count), output.AsSpan(outputOffset));
Microsoft.AspNetCore.Components (6)
ParameterView.cs (1)
126_frames.AsSpan(1, numEntries).CopyTo(cloneBuffer.AsSpan(1));
Routing\RouteContext.cs (1)
62Buffer = _pooled.AsSpan(0, length);
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (1)
83=> Append(source.AsSpan(startIndex, length));
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (3)
42return _rentedBuffer.AsSpan(0, _index); 95_rentedBuffer.AsSpan(0, _index).Clear(); 199var previousBuffer = oldBuffer.AsSpan(0, _index);
Microsoft.AspNetCore.Components.Endpoints (2)
Builder\ResourceCollectionUrlEndpoint.cs (1)
187incrementalHash.AppendData(rented.AsSpan(0, bytesWritten));
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (1)
160var previousBuffer = oldBuffer.AsSpan(0, _index);
Microsoft.AspNetCore.Components.Server (11)
Circuits\ServerComponentDeserializer.cs (1)
308: (seenComponentIdsStorage = ArrayPool<int>.Shared.Rent(operations.Length)).AsSpan(0, operations.Length);
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (1)
83=> Append(source.AsSpan(startIndex, length));
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (3)
42return _rentedBuffer.AsSpan(0, _index); 95_rentedBuffer.AsSpan(0, _index).Clear(); 199var previousBuffer = oldBuffer.AsSpan(0, _index);
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
Microsoft.AspNetCore.Components.WebAssembly (2)
Rendering\WebAssemblyRenderer.cs (1)
219var batchBytes = arrayBuilder.Buffer.AsSpan(0, arrayBuilder.Count).ToArray();
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (1)
83=> Append(source.AsSpan(startIndex, length));
Microsoft.AspNetCore.Components.WebView (1)
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (1)
83=> Append(source.AsSpan(startIndex, length));
Microsoft.AspNetCore.DataProtection (8)
KeyManagement\KeyRingBasedDataProtector.cs (2)
213var magicHeaderFromPayload = BinaryPrimitives.ReadUInt32BigEndian(protectedData.AsSpan(0, sizeof(uint))); 377Span<int> purposeLengthsPool = targetLength <= 32 ? stackalloc int[targetLength] : (lease = ArrayPool<int>.Shared.Rent(targetLength)).AsSpan(0, targetLength);
Managed\ManagedAuthenticatedEncryptor.cs (2)
634operationSubkey: tempKeys.AsSpan(0, _symmetricAlgorithmSubkeyLengthInBytes), 635validationSubkey: tempKeys.AsSpan(_symmetricAlgorithmSubkeyLengthInBytes, _validationAlgorithmSubkeyLengthInBytes));
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (1)
160var previousBuffer = oldBuffer.AsSpan(0, _index);
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (3)
42return _rentedBuffer.AsSpan(0, _index); 95_rentedBuffer.AsSpan(0, _index).Clear(); 199var previousBuffer = oldBuffer.AsSpan(0, _index);
Microsoft.AspNetCore.DataProtection.Abstractions (3)
src\aspnetcore\src\Shared\WebEncoders\WebEncoders.cs (3)
172Span<char> bufferSpan = buffer.AsSpan(i, count); 287return Base64UrlEncode(input.AsSpan(offset, count)); 342return Base64UrlEncode(input.AsSpan(offset, count), output.AsSpan(outputOffset));
Microsoft.AspNetCore.DataProtection.MicroBenchmarks (4)
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (1)
160var previousBuffer = oldBuffer.AsSpan(0, _index);
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (3)
42return _rentedBuffer.AsSpan(0, _index); 95_rentedBuffer.AsSpan(0, _index).Clear(); 199var previousBuffer = oldBuffer.AsSpan(0, _index);
Microsoft.AspNetCore.Diagnostics.Middleware (2)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\BufferWriterPool\BufferWriter.cs (2)
54public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, WrittenCount); 100_buffer.AsSpan(0, WrittenCount).Clear();
Microsoft.AspNetCore.Http (1)
src\aspnetcore\src\Shared\Dictionary\AdaptiveCapacityDictionary.cs (1)
547return _arrayStorage.AsSpan(0, _count);
Microsoft.AspNetCore.Http.Connections (9)
src\aspnetcore\src\Shared\WebEncoders\WebEncoders.cs (3)
172Span<char> bufferSpan = buffer.AsSpan(i, count); 287return Base64UrlEncode(input.AsSpan(offset, count)); 342return Base64UrlEncode(input.AsSpan(offset, count), output.AsSpan(outputOffset));
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
Microsoft.AspNetCore.Http.Connections.Common (1)
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
87WriteInternal(buffer.AsSpan(index, count));
Microsoft.AspNetCore.Http.Extensions (1)
src\aspnetcore\src\Shared\PropertyAsParameterInfo.cs (1)
91list.AddRange(parameters.AsSpan(0, i));
Microsoft.AspNetCore.HttpLogging (4)
RequestBufferingStream.cs (2)
55WriteToBuffer(buffer.AsSpan(offset, res)); 70WriteToBuffer(buffer.AsSpan(offset, res));
ResponseBufferingStream.cs (1)
93Write(buffer.AsSpan(offset, count));
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (1)
160var previousBuffer = oldBuffer.AsSpan(0, _index);
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
src\aspnetcore\src\Shared\PropertyAsParameterInfo.cs (1)
91list.AddRange(parameters.AsSpan(0, i));
Microsoft.AspNetCore.Mvc.ViewFeatures (3)
src\aspnetcore\src\Shared\PooledArrayBufferWriter.cs (3)
42return _rentedBuffer.AsSpan(0, _index); 95_rentedBuffer.AsSpan(0, _index).Clear(); 199var previousBuffer = oldBuffer.AsSpan(0, _index);
Microsoft.AspNetCore.OpenApi (8)
src\aspnetcore\src\Shared\PropertyAsParameterInfo.cs (1)
91list.AddRange(parameters.AsSpan(0, i));
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
87WriteInternal(buffer.AsSpan(index, count));
Microsoft.AspNetCore.OutputCaching (3)
RecyclableArrayBufferWriter.cs (2)
78public T[] ToArray() => _buffer.AsSpan(0, _index).ToArray(); 120oldArray.AsSpan(0, _index).CopyTo(_buffer);
Streams\OutputCacheStream.cs (1)
125_segmentWriteStream.Write(buffer.AsSpan(offset, count));
Microsoft.AspNetCore.Razor.Utilities.Shared (5)
PooledArrayBufferWriter`1.cs (2)
89_rentedBuffer.AsSpan(0, _index).Clear(); 185var previousBuffer = oldBuffer.AsSpan(0, _index);
src\roslyn\src\Razor\src\Shared\Microsoft.AspNetCore.Razor.SharedUtilities\PooledObjects\PooledArray`1.cs (1)
31public readonly Span<T> Span => _array!.AsSpan(0, _minimumLength);
Utilities\Checksum.Builder.cs (2)
50return buffer.AsSpan(0, length); 67_hash.Append(s_buffer.AsSpan(0, count));
Microsoft.AspNetCore.ResponseCaching (1)
src\aspnetcore\src\Shared\SegmentWriteStream.cs (1)
130Write(buffer.AsSpan(offset, count));
Microsoft.AspNetCore.Server.HttpSys (1)
RequestProcessing\RequestStream.cs (1)
134buffer.AsSpan(offset, size),
Microsoft.AspNetCore.Server.Kestrel.Core (11)
Internal\Http2\Http2FrameWriter.cs (4)
643_outputWriter.Write(_headerEncodingBuffer.AsSpan(0, payloadLength)); 650_outputWriter.Write(_headerEncodingBuffer.AsSpan(0, payloadLength)); 660buffer = largeHeaderBuffer.AsSpan(0, _headersEncodingLargeBufferSize); 692buffer = largeHeaderBuffer.AsSpan(0, _headersEncodingLargeBufferSize);
src\aspnetcore\src\Servers\Kestrel\shared\PooledStreamStack.cs (2)
124array.AsSpan(removeCount, newSize).CopyTo(array); 127array.AsSpan(newSize, size - newSize).Clear();
src\aspnetcore\src\Shared\Buffers\RefPooledArrayBufferWriter.cs (1)
160var previousBuffer = oldBuffer.AsSpan(0, _index);
src\aspnetcore\src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (2)
507? _headerValueOctets.AsSpan(0, _headerValueLength) 522? _headerName.AsSpan(0, _headerNameLength)
src\aspnetcore\src\Shared\runtime\Http3\QPack\QPackDecoder.cs (2)
594? _headerValueOctets.AsSpan(0, _headerValueLength) 604? _headerName.AsSpan(0, _headerNameLength)
Microsoft.AspNetCore.Server.Kestrel.Transport.DirectTls (1)
TlsEventPump.cs (1)
1159if (!session.TryGetClientHelloBytes(buffer.AsSpan(0, length), out var written) || written <= 0)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (2)
src\aspnetcore\src\Servers\Kestrel\shared\PooledStreamStack.cs (2)
124array.AsSpan(removeCount, newSize).CopyTo(array); 127array.AsSpan(newSize, size - newSize).Clear();
Microsoft.AspNetCore.SignalR.Common (7)
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
87WriteInternal(buffer.AsSpan(index, count));
Microsoft.AspNetCore.SignalR.Protocols.Json (1)
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
87WriteInternal(buffer.AsSpan(index, count));
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (6)
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (7)
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
src\aspnetcore\src\SignalR\common\Shared\Utf8BufferTextWriter.cs (1)
87WriteInternal(buffer.AsSpan(index, count));
Microsoft.AspNetCore.SignalR.Specification.Tests (6)
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
Microsoft.AspNetCore.SignalR.StackExchangeRedis (6)
src\aspnetcore\src\SignalR\common\Shared\MemoryBufferWriter.cs (6)
120return _currentSegment.AsSpan(_position, _currentSegment.Length - _position); 135destination.Write(_currentSegment.AsSpan(0, _position)); 242_currentSegment.AsSpan(0, _position).CopyTo(result.AsSpan(totalWritten)); 271_currentSegment.AsSpan(0, _position).CopyTo(span.Slice(totalWritten)); 310BuffersExtensions.Write(this, buffer.AsSpan(offset, count)); 391public ReadOnlySpan<byte> Span => Buffer.AsSpan(0, Length);
Microsoft.AspNetCore.Watch.BrowserRefresh (2)
src\sdk\src\Dotnet.Watch\Web.Middleware\ResponseStreamWrapper.cs (1)
80_baseStream.Write(buffer.AsSpan(offset, count));
src\sdk\src\Dotnet.Watch\Web.Middleware\ScriptInjectingStream.cs (1)
67ScriptInjectionPerformed = TryInjectScript(buffer.AsSpan(offset, count));
Microsoft.AspNetCore.WebUtilities (10)
BufferedReadStream.cs (2)
399builder.Write(_buffer.AsSpan(_bufferOffset - writeCount, writeCount)); 417builder.Write(_buffer.AsSpan(_bufferOffset - writeCount, writeCount));
FileBufferingReadStream.cs (3)
290_buffer.Write(rentedBuffer.AsSpan(0, copyRead)); 301_buffer.Write(_rentedBuffer.AsSpan(0, (int)oldBuffer.Length)); 323return Read(buffer.AsSpan(offset, count));
FormPipeReader.cs (1)
364Span<byte> buffer = byteArray.AsSpan(0, (int)ros.Length);
MultipartReaderStream.cs (1)
187var slice = buffer.AsSpan(offset, Math.Min(count, index));
src\aspnetcore\src\Shared\WebEncoders\WebEncoders.cs (3)
172Span<char> bufferSpan = buffer.AsSpan(i, count); 287return Base64UrlEncode(input.AsSpan(offset, count)); 342return Base64UrlEncode(input.AsSpan(offset, count), output.AsSpan(outputOffset));
Microsoft.Build (1)
Logging\OptimizedStringIndenter.cs (1)
140segments = pooledArray.AsSpan(0, segmentCount);
Microsoft.Build.Framework (2)
BackEnd\InterningBinaryReader.cs (2)
141return Strings.WeakIntern(charBuffer.AsSpan(0, charsRead)); 151var retval = Strings.WeakIntern(resultBuffer.AsSpan(0, charsRead));
Microsoft.Build.Tasks.Core (1)
ManifestUtil\mansign2.cs (1)
1027return Convert.ToHexStringLower(array.AsSpan(start, end - start));
Microsoft.CodeAnalysis (8)
InternalUtilities\Hash.cs (1)
356=> GetFNVHashCode(text.AsSpan(start, length));
InternalUtilities\StringTable.cs (1)
120=> Add(chars.AsSpan(start, len));
InternalUtilities\TextKeyedCache.cs (2)
112=> FindItem(chars.AsSpan(start, len), hashCode); 184=> AddItem(chars.AsSpan(start, len), hashCode, item);
Text\SourceText.cs (4)
647var charSpan = charBuffer.AsSpan(0, charsToCopy); 741tempBuffer.AsSpan(0, copyLength).CopyTo(buffer); 1257if (!buffer1.AsSpan(0, count).SequenceEqual(buffer2.AsSpan(0, count)))
Microsoft.CodeAnalysis.Analyzers (7)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
356=> GetFNVHashCode(text.AsSpan(start, length));
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (1)
120=> Add(chars.AsSpan(start, len));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
194_concatenatedLowerCaseWords.AsSpan(currentNode.CharacterSpan.Start, currentNode.CharacterSpan.Length), 195_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
120_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (1)
97_sourceLowerCaseCharacters.AsSpan(0, _source.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
98: rentedArray.AsSpan(0, decodedLength);
Microsoft.CodeAnalysis.AnalyzerUtilities (7)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
356=> GetFNVHashCode(text.AsSpan(start, length));
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (1)
120=> Add(chars.AsSpan(start, len));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
194_concatenatedLowerCaseWords.AsSpan(currentNode.CharacterSpan.Start, currentNode.CharacterSpan.Length), 195_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
120_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (1)
97_sourceLowerCaseCharacters.AsSpan(0, _source.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
98: rentedArray.AsSpan(0, decodedLength);
Microsoft.CodeAnalysis.CodeStyle (7)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
356=> GetFNVHashCode(text.AsSpan(start, length));
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (1)
120=> Add(chars.AsSpan(start, len));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
194_concatenatedLowerCaseWords.AsSpan(currentNode.CharacterSpan.Start, currentNode.CharacterSpan.Length), 195_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
120_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (1)
97_sourceLowerCaseCharacters.AsSpan(0, _source.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
98: rentedArray.AsSpan(0, decodedLength);
Microsoft.CodeAnalysis.CSharp (1)
Parser\SlidingTextWindow.cs (1)
384=> Intern(array.AsSpan(start, length));
Microsoft.CodeAnalysis.Extensions.Package (1)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
356=> GetFNVHashCode(text.AsSpan(start, length));
Microsoft.CodeAnalysis.Razor.Compiler (1)
Language\CodeGeneration\CodeWriter.cs (1)
404var destination = buffer.AsSpan(index, count);
Microsoft.CodeAnalysis.ResxSourceGenerator (7)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
356=> GetFNVHashCode(text.AsSpan(start, length));
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (1)
120=> Add(chars.AsSpan(start, len));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
194_concatenatedLowerCaseWords.AsSpan(currentNode.CharacterSpan.Start, currentNode.CharacterSpan.Length), 195_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
120_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (1)
97_sourceLowerCaseCharacters.AsSpan(0, _source.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
98: rentedArray.AsSpan(0, decodedLength);
Microsoft.CodeAnalysis.Workspaces (7)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
356=> GetFNVHashCode(text.AsSpan(start, length));
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (1)
120=> Add(chars.AsSpan(start, len));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
194_concatenatedLowerCaseWords.AsSpan(currentNode.CharacterSpan.Start, currentNode.CharacterSpan.Length), 195_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
120_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (1)
97_sourceLowerCaseCharacters.AsSpan(0, _source.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
98: rentedArray.AsSpan(0, decodedLength);
Microsoft.CSharp (1)
src\runtime\src\libraries\Common\src\System\Runtime\InteropServices\ComEventsMethod.cs (1)
196wrappers.AsSpan(0, removeIdx).CopyTo(newWrappers);
Microsoft.Diagnostics.DataContractReader.Contracts (4)
Contracts\Debugger\Debugger_1.cs (1)
267_target.WriteBuffer(remotePtr.Value, record.AsSpan(0, cbSize));
Contracts\EcmaMetadata_1.cs (1)
523target.ReadBuffer(data, result.AsSpan(offset, checked((int)size)));
LinearReadCache.cs (2)
65_page.AsSpan((int)offset, dest.Length).CopyTo(dest); 74_target.ReadBuffer(pageStart, _page.AsSpan(0, (int)PageSize));
Microsoft.Diagnostics.DataContractReader.Legacy (4)
ClrDataValue.cs (1)
841Debug.Assert(nameBuf is null || new ReadOnlySpan<char>(nameBuf, checked((int)nameLenLocal)).SequenceEqual(nameBufLocal.AsSpan(0, checked((int)nameLenLocal))));
Dbi\DacDbiImpl.cs (1)
512Debug.Assert(new Span<byte>(pBuffer, blobLength).SequenceEqual(bufferLocal.AsSpan(0, blobLength)), "cDAC and DAC read-write metadata buffers differ.");
SOSDacImpl.cs (1)
2201Debug.Assert(name == null || new ReadOnlySpan<byte>(name, (int)neededLocal).SequenceEqual(nameLocal!.AsSpan(0, (int)neededLocal)));
SOSDacImpl.IXCLRDataProcess.cs (1)
372.SequenceEqual(nameBufLocal.AsSpan(0, (int)nameLenLocal)));
Microsoft.DotNet.Build.Tasks.FileCatalog (1)
CatalogBuilder.cs (1)
248return hash.AsSpan(0, ListIdentifierLength).ToArray();
Microsoft.DotNet.Build.Tasks.Installers (1)
src\ArReader.cs (1)
103stream.ReadExactly(buffer.AsSpan(offset, count));
Microsoft.DotNet.HotReload.Watch (2)
src\sdk\src\Dotnet.Watch\HotReloadAgent.PipeRpc\StreamExtensions.cs (2)
73BinaryPrimitives.WriteInt32LittleEndian(buffer.AsSpan((i + 1) * sizeof(int), sizeof(int)), value[i]); 150return new Guid(buffer.AsSpan(0, size));
Microsoft.Extensions.AI (2)
ChatCompletion\DistributedCachingChatClient.cs (1)
151return AIJsonUtilities.HashDataToString(arr.AsSpan(0, length), JsonSerializerOptions);
Embeddings\DistributedCachingEmbeddingGenerator.cs (1)
125return AIJsonUtilities.HashDataToString(arr.AsSpan(0, length), _jsonSerializerOptions);
Microsoft.Extensions.AI.Abstractions (4)
Contents\DataContent.cs (1)
291_uri = array.AsSpan(0, prefixLength + dataLength).ToString();
Embeddings\BinaryEmbedding.cs (2)
66utf8 = tmpArray.AsSpan(0, reader.CopyString(tmpArray)); 100Span<byte> utf8 = tmpArray.AsSpan(0, length);
Functions\AIFunctionFactory.cs (1)
1387public ReadOnlySpan<byte> GetBuffer() => _buffer.AsSpan(0, _position);
Microsoft.Extensions.AI.OpenAI (2)
MicrosoftExtensionsAIChatExtensions.cs (1)
246return JsonElement.Parse(ms.GetBuffer().AsSpan(0, (int)ms.Position));
OpenAISpeechToTextClient.cs (1)
210return $"audio.{DetectAudioExtension(header.AsSpan(0, bytesRead))}";
Microsoft.Extensions.Caching.Hybrid (10)
Internal\BufferChunk.cs (1)
65OversizedArray.AsSpan(Offset, length).CopyTo(copy);
Internal\HybridCachePayload.cs (6)
106BinaryPrimitives.WriteUInt16LittleEndian(destination.AsSpan(0, 2), UInt16SentinelPrefixPair); 107BinaryPrimitives.WriteUInt16LittleEndian(destination.AsSpan(2, 2), (ushort)_entropySource.Next(0, 0x010000)); // Next is exclusive at RHS 108BinaryPrimitives.WriteInt64LittleEndian(destination.AsSpan(4, 8), creationTime); 138payload.CopyTo(destination.AsSpan(len, payloadLength)); 140BinaryPrimitives.WriteUInt16LittleEndian(destination.AsSpan(len, 2), UInt16SentinelPrefixPair); 311pendingTags = new(pendingTagBuffer.AsSpan(0, pendingTagsCount).ToArray());
Internal\RecyclableArrayBufferWriter.cs (2)
132public T[] ToArray() => _buffer.AsSpan(0, _index).ToArray(); 194oldArray.AsSpan(0, _index).CopyTo(_buffer);
Internal\TagSet.cs (1)
161string[] final = oversized.AsSpan(0, count).ToArray();
Microsoft.Extensions.Compliance.Abstractions (1)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\RentedSpan\RentedSpan.cs (1)
93public Span<T> Span => _rentedBuffer != null ? _rentedBuffer.AsSpan(0, _length) : default;
Microsoft.Extensions.DependencyModel (2)
DependencyContextJsonReader.cs (2)
93utf8Bom.SequenceEqual(rented.AsSpan(0, utf8Bom.Length))) 120rented.AsSpan(0, written).Clear();
Microsoft.Extensions.Diagnostics.ResourceMonitoring (3)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\BufferWriterPool\BufferWriter.cs (2)
54public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, WrittenCount); 100_buffer.AsSpan(0, WrittenCount).Clear();
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\RentedSpan\RentedSpan.cs (1)
93public Span<T> Span => _rentedBuffer != null ? _rentedBuffer.AsSpan(0, _length) : default;
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (1)
Linux\OSFileSystemTests.cs (1)
72Assert.True(b.AsSpan(0, written).SequenceEqual(new string(Content, written).AsSpan()));
Microsoft.Extensions.DotNetDeltaApplier (2)
src\sdk\src\Dotnet.Watch\HotReloadAgent.PipeRpc\StreamExtensions.cs (2)
73BinaryPrimitives.WriteInt32LittleEndian(buffer.AsSpan((i + 1) * sizeof(int), sizeof(int)), value[i]); 150return new Guid(buffer.AsSpan(0, size));
Microsoft.Extensions.Http.Diagnostics (2)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\BufferWriterPool\BufferWriter.cs (2)
54public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, WrittenCount); 103_buffer.AsSpan(0, WrittenCount).Clear();
Microsoft.Extensions.Identity.Core (1)
PasswordHasher.cs (1)
267byte[] salt = hashedPassword.AsSpan(13, saltLength).ToArray();
Microsoft.Extensions.ServiceDiscovery.Dns (1)
Resolver\DnsResolver.cs (1)
809responseLength = BinaryPrimitives.ReadUInt16BigEndian(buffer.AsSpan(0, 2));
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (4)
Resolver\DnsPrimitivesTests.cs (1)
47Assert.False(DnsPrimitives.TryWriteQName(buffer.AsSpan(0, i), name, out _));
Resolver\LoopbackDnsServer.cs (3)
99length = BinaryPrimitives.ReadUInt16BigEndian(buffer.AsSpan(0, 2)); 104BinaryPrimitives.WriteUInt16BigEndian(buffer.AsSpan(0, 2), (ushort)bytesWritten); 213return buffer.AsSpan(0, bytesWritten).ToArray();
Microsoft.Extensions.ServiceDiscovery.Dns.Tests.Fuzzing (1)
Fuzzers\DnsResponseFuzzer.cs (1)
31_buffer.AsSpan(0, Math.Min(_length, buffer.Length - 2)).CopyTo(buffer.Span.Slice(2));
Microsoft.Extensions.Telemetry (1)
parent\parent\parent\eng\MSBuild\parent\parent\src\Shared\RentedSpan\RentedSpan.cs (1)
93public Span<T> Span => _rentedBuffer != null ? _rentedBuffer.AsSpan(0, _length) : default;
Microsoft.JSInterop (2)
Infrastructure\DotNetDispatcher.cs (1)
229var reader = new Utf8JsonReader(buffer.AsSpan(0, count));
src\aspnetcore\src\Components\Shared\src\ArrayBuilder.cs (1)
83=> Append(source.AsSpan(startIndex, length));
Microsoft.ML.Core (8)
Utilities\BigArray.cs (6)
408_entries[maMax].AsSpan(miMin, length).CopyTo(dst); 414_entries[maMin].AsSpan(miMin, BlockSize - miMin).CopyTo(dst); 416_entries[maMax].AsSpan(0, miLim).CopyTo(dst.Slice(BlockSize - miMin)); 425_entries[maMin].AsSpan(miMin, dstSoFar).CopyTo(dst); 430_entries[major].AsSpan(0, BlockSize).CopyTo(dst.Slice(dstSoFar)); 437_entries[maMax].AsSpan(0, miLim).CopyTo(dst.Slice(dstSoFar));
Utilities\Stream.cs (2)
497ReadBinaryDataIntoSpan(reader, array.AsSpan(start, count)); 717rentedArray.AsSpan(0, numElementsToReadThisChunk * sizeof(T)).CopyTo(MemoryMarshal.AsBytes(destination.Slice(0, numElementsToReadThisChunk)));
Microsoft.ML.CpuMath (6)
AlignedArray.cs (2)
115Items.AsSpan(_base, count).CopyTo(dst.Slice(index)); 123Items.AsSpan(start + _base, count).CopyTo(dst.Slice(index));
AlignedMatrix.cs (4)
183_items.CopyFrom(src.AsSpan(index, _size)); 201_items.CopyFrom(ivDst, src.AsSpan(ivSrc, _size)); 466Items.CopyFrom(src.AsSpan(ivSrc, ValueCount)); 473Items.CopyFrom(row * ColCountPhy, src.AsSpan(ivSrc, ColCount));
Microsoft.ML.CpuMath.PerformanceTests (11)
PerformanceTests.cs (3)
108testMatrixAligned.CopyFrom(src.AsSpan(0, (matrixLength - 1) * (matrixLength - 1))); 111testSrcVectorAligned.CopyFrom(src1.AsSpan(0, matrixLength - 1)); // odd input 114testDstVectorAligned.CopyFrom(dst.AsSpan(0, matrixLength));
SmallInputCpuMathPerformanceTests.cs (8)
17=> CpuMathUtils.Add(DefaultScale, dst.AsSpan(0, arrayLength)); 21=> CpuMathUtils.Scale(DefaultScale, dst.AsSpan(0, arrayLength)); 29=> CpuMathUtils.ScaleAdd(DefaultScale, DefaultScale, dst.AsSpan(0, arrayLength)); 65=> CpuMathUtils.SumSq(DefaultScale, src.AsSpan(0, arrayLength)); 69=> CpuMathUtils.SumAbs(src.AsSpan(0, arrayLength)); 73=> CpuMathUtils.SumAbs(DefaultScale, src.AsSpan(0, arrayLength)); 77=> CpuMathUtils.MaxAbs(src.AsSpan(0, arrayLength)); 81=> CpuMathUtils.MaxAbsDiff(DefaultScale, src.AsSpan(0, arrayLength));
Microsoft.ML.Data (15)
Data\BufferBuilder.cs (3)
454_values.AsSpan(0, _length).CopyTo(editor.Values); 461_values.AsSpan(0, _count).CopyTo(editor.Values); 462_indices.AsSpan(0, _count).CopyTo(editor.Indices);
DataLoadSave\Binary\Codecs.cs (3)
1096_values.AsSpan(_valuesOffset, length) 1107_values.AsSpan(_valuesOffset, count) 1109_indices.AsSpan(_indicesOffset, count)
DataLoadSave\Text\TextLoaderParser.cs (2)
426_values.AsSpan(0, _count).CopyTo(editor.Values); 433_indices.AsSpan(0, _count).CopyTo(editor.Indices);
DataView\AppendRowsDataView.cs (1)
456Utils.Shuffle(_rand, _batch.AsSpan(0, _batchEnd));
DataView\DataViewConstructionUtils.cs (2)
347buf.AsSpan(0, n).CopyTo(dstEditor.Values); 999value.AsSpan(0, n).CopyTo(dstEditor.Values);
Deprecated\Vector\VectorUtils.cs (1)
420return L2DistSquaredHalfSparse(a.AsSpan(0, a.Length), b.GetValues(), b.GetIndices());
Transforms\NormalizeColumnDbl.cs (1)
278ctx.Writer.WriteDoublesNoCount(stddev.AsSpan(0, mean.Length));
Transforms\NormalizeColumnSng.cs (1)
278ctx.Writer.WriteSinglesNoCount(stddev.AsSpan(0, mean.Length));
Utils\SequencePool.cs (1)
122writer.WriteIntsNoCount(_start.AsSpan(0, _idLim + 1));
Microsoft.ML.DataView (12)
VBuffer.cs (10)
65public ReadOnlySpan<T> GetValues() => _values.AsSpan(0, _count); 80public ReadOnlySpan<int> GetIndices() => IsDense ? default : _indices.AsSpan(0, _count); 184_values.AsSpan(0, Length).CopyTo(editor.Values); 200_values.AsSpan(0, Length).CopyTo(editor.Values); 209_values.AsSpan(0, _count).CopyTo(editor.Values); 210_indices.AsSpan(0, _count).CopyTo(editor.Indices); 233_values.AsSpan(sourceIndex, length).CopyTo(editor.Values); 250_values.AsSpan(copyMin, copyCount).CopyTo(editor.Values); 294_values.AsSpan(0, Length).CopyTo(destination.Slice(destinationIndex)); 328source.AsSpan(sourceIndex, length).CopyTo(editor.Values);
VBufferEditor.cs (2)
122Values = _values.AsSpan(0, physicalValuesCount); 123Indices = !isDense || requireIndicesOnDense ? _indices.AsSpan(0, physicalValuesCount) : default;
Microsoft.ML.FastTree (9)
TreeEnsemble\InternalRegressionTree.cs (1)
400writer.WriteIntsNoCount(CategoricalSplitFeatureRanges[indexLocal].AsSpan(0, 2));
Utils\ToByteArrayExtensions.cs (8)
304buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan())); 337buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan())); 375buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan())); 408buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan())); 441buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan())); 474buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan())); 507buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan())); 540buffer.AsSpan(position, byteLength).CopyTo(MemoryMarshal.AsBytes(a.AsSpan()));
Microsoft.ML.PCA (1)
PcaTransformer.cs (1)
160ctx.Writer.WriteSinglesNoCount(Eigenvectors[i].AsSpan(0, Dimension));
Microsoft.ML.StandardTrainers (3)
Standard\LogisticRegression\MulticlassLogisticRegression.cs (2)
257float logZ = MathUtils.SoftMax(scores.AsSpan(0, _numClasses)); 653ctx.Writer.WriteSinglesNoCount(Biases.AsSpan(0, NumberOfClasses));
Standard\MulticlassClassification\MulticlassNaiveBayesTrainer.cs (1)
383ctx.Writer.WriteDoublesNoCount(_absentFeaturesLogProb.AsSpan(0, _labelCount));
Microsoft.ML.TestFrameworkCommon (1)
TestLogger.cs (1)
47var span = buffer.AsSpan(index, count);
Microsoft.ML.Tokenizers (12)
Model\BPETokenizer.cs (1)
872string decodedString = Helpers.GetString(bytes.AsSpan(0, bytesIndex));
Model\SentencePieceBaseModel.cs (4)
333int charCount = Helpers.GetChars(bytesPoolArray.AsSpan(0, bytesCount), charPoolArray); 335sb.Append(charPoolArray.AsSpan(0, charCount)); 671int charCount = Helpers.GetChars(bytesPoolArray.AsSpan(0, bytesCount), charPoolArray); 678charPoolArray.AsSpan(0, charCount).CopyTo(buffer);
Normalizer\SentencePieceNormalizer.cs (2)
122int length = Normalize(inputArray.AsSpan(0, inputLength), ref normalized, ref poolArray); 405return NormalizeCore(chainedBytes.AsSpan(0, chainedLength), ref normalized, ref poolArray);
PreTokenizer\CompositePreTokenizer.cs (1)
176foreach ((int Offset, int Length) range in preTokenizer.PreTokenize(text.AsSpan(offset, length)))
SentencepieceModel.cs (1)
166internal ReadOnlySpan<byte> Span => data is null ? ReadOnlySpan<byte>.Empty : data.AsSpan(offset, length);
Tokenizer.cs (1)
392string result = destination.AsSpan(0, charsWritten).ToString();
Utils\BytePairEncoder.cs (2)
160Span<State> state = statePoolArray.AsSpan(0, stateLength); 285var result = resultPoolArray.AsSpan(0, resultCount).ToArray();
Microsoft.ML.Tokenizers.Tests (6)
BpeTests.cs (4)
850Assert.Equal(beginningOfSentenceToken + text, destinationBuffer.AsSpan(0, charsWritten).ToString()); 853Assert.Equal(text, destinationBuffer.AsSpan(0, charsWritten).ToString()); 855Assert.Equal(OperationStatus.DestinationTooSmall, tokenizer.Decode(ids, destinationBuffer.AsSpan(0, text.Length - 1), considerSpecialTokens: false, out idsConsumed, out charsWritten)); 858Assert.Equal(OperationStatus.DestinationTooSmall, tokenizer.Decode(ids, destinationBuffer.AsSpan(0, text.Length), considerSpecialTokens: true, out idsConsumed, out charsWritten));
DoubleArrayTrieTest.cs (1)
84Assert.StartsWith(Helpers.GetString(utf8Bytes.AsSpan(0, doubleArrayResultPairs[i].Length)), key, StringComparison.Ordinal);
LlamaTests.cs (1)
914Assert.Equal(textWithSpecialTokens, destinationBuffer.AsSpan(0, charactersWritten).ToString());
Microsoft.ML.TorchSharp (11)
Roberta\Models\RobertaModel.cs (8)
116var position = torch.tensor(DataUtils.Concat<int>(Positions.AsSpan(0, allSize), Zeros.AsSpan(0, size - allSize)), 118var segment = questionSize == size - 1 ? torch.tensor(Zeros.AsSpan(0, size).ToArray(), 1, size, dtype: torch.int64, device: device) : 119torch.tensor(DataUtils.Concat<int>(Zeros.AsSpan(0, questionSize + 2), Ones.AsSpan(0, allSize - questionSize - 2), Zeros.AsSpan(0, size - allSize)), 121var attentionMask = torch.tensor(DataUtils.Concat<int>(Zeros.AsSpan(0, allSize), NegBillionPad.AsSpan(0, size - allSize)),
Roberta\Modules\AttentionSelf.cs (2)
69var contextShape = DataUtils.Concat<long>(contextLayer.shape.AsSpan(0, contextLayer.shape.Length - 2), NumAttentionHeads * AttentionHeadSize); 80var newShape = DataUtils.Concat<long>(x.shape.AsSpan(0, x.shape.Length - 1), NumAttentionHeads, AttentionHeadSize);
Roberta\QATrainer.cs (1)
927outputCache.PredictedAnswersBuffer[index] = new ReadOnlyMemory<char>(_parent.Tokenizer.Decode(_parent.Tokenizer.RobertaModel().ConvertOccurrenceRanksToIds(contextIds).ToArray().AsSpan(predictStart - questionLength - 2, predictEnd - predictStart).ToArray()).Trim().ToCharArray());
Microsoft.ML.Transforms (1)
GroupTransform.cs (1)
477_buffer.AsSpan(0, _size).CopyTo(editor.Values);
Microsoft.NET.Build.Containers (2)
Layer.cs (2)
295public override void Write(byte[] buffer, int offset, int count) => Write(buffer.AsSpan(offset, count)); 367WriteCore(headerBlock.AsSpan(0, headerBytes));
Microsoft.NET.Build.Tasks (1)
NugetContentAssetPreprocessor.cs (1)
76return BitConverter.ToString(XxHash3.Hash(stream.GetBuffer().AsSpan(0, (int)stream.Length))).Replace("-", "");
Microsoft.NET.HostModel (5)
MachO\BinaryFormat\Blobs\CodeDirectoryBlob.cs (2)
50byte[] bytes = data.AsSpan(specialSlotHashesOffset + i * hashSize, hashSize).ToArray(); 57codeHashes[codeSlotNumber] = data.AsSpan(hashesDataOffset + codeSlotNumber * hashSize, hashSize).ToArray();
src\runtime\src\coreclr\tools\Common\System\Collections\Generic\ArrayBuilder.cs (3)
49public readonly Span<T> AsSpan() => _items.AsSpan(0, _count); 51public readonly Span<T> AsSpan(int start) => _items.AsSpan(start, _count - start); 59return _items.AsSpan(origCount, length);
Microsoft.NET.Sdk.StaticWebAssets.Tasks (1)
Utils\HashingUtils.cs (1)
63hashSet.Add(Convert.ToBase64String(ComputeHash(memoryStream, candidateAssets.AsSpan(i, 1), properties: metadata)), candidate);
NuGet.Common (1)
MsBuildStringUtility.cs (1)
123var retVal = logCodes.AsSpan(0, index).ToImmutableArray();
NuGet.ProjectModel (4)
JsonPackageSpecReader.Utf8JsonStreamReader.cs (1)
1192var retVal = items.AsSpan(0, index).ToImmutableArray();
src\nuget-client\build\Shared\Utf8JsonStreamReader.cs (3)
67bool hasUtf8Bom = Utf8Bom.AsSpan().SequenceEqual(_buffer.AsSpan(start: 0, length: 3)); 237var retVal = strings.AsSpan(0, index).ToImmutableArray(); 377_reader = new Utf8JsonReader(_buffer.AsSpan(0, _bufferUsed), isFinalBlock: bytesRead == 0, jsonReaderState);
PresentationCore (2)
System\Windows\Input\Stylus\Common\StylusPointCollection.cs (1)
177data = rawPacketData.AsSpan(rawArrayStartIndex, dataLength).ToArray();
System\Windows\Media\StreamAsIStream.cs (1)
216hr = Read(buffer.AsSpan(0, (int) toRead), out read);
PresentationFramework (6)
System\Windows\Controls\Grid.cs (6)
1542tempDefinitions.AsSpan(0, count).Sort(s_spanPreferredDistributionOrderComparer); 1579tempDefinitions.AsSpan(0, count).Sort(s_spanMaxDistributionOrderComparer); 1724tempDefinitions.AsSpan(0, starDefinitionsCount).Sort(s_starDistributionOrderComparer); 1883tempDefinitions.AsSpan(0, minCount).Sort(s_minRatioComparer); 1884tempDefinitions.AsSpan(defCount, maxCount).Sort(s_maxRatioComparer); 2040tempDefinitions.AsSpan(0, starCount).Sort(s_starWeightComparer);
Roslyn.Diagnostics.Analyzers (7)
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\Hash.cs (1)
356=> GetFNVHashCode(text.AsSpan(start, length));
src\roslyn\src\Compilers\Core\Portable\InternalUtilities\StringTable.cs (1)
120=> Add(chars.AsSpan(start, len));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.Builder.cs (2)
194_concatenatedLowerCaseWords.AsSpan(currentNode.CharacterSpan.Start, currentNode.CharacterSpan.Length), 195_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length));
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\BKTree.cs (1)
120_concatenatedLowerCaseWords.AsSpan(characterSpan.Start, characterSpan.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\EditDistance.cs (1)
97_sourceLowerCaseCharacters.AsSpan(0, _source.Length),
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Utilities\InterceptsLocationUtilities.cs (1)
98: rentedArray.AsSpan(0, decodedLength);
Shared (11)
BufferWriterPool\BufferWriter.cs (2)
54public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, WrittenCount); 100_buffer.AsSpan(0, WrittenCount).Clear();
RentedSpan\RentedSpan.cs (1)
93public Span<T> Span => _rentedBuffer != null ? _rentedBuffer.AsSpan(0, _length) : default;
ServerSentEvents\SseParser_1.cs (8)
137_newlineIndex = _lineBuffer.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF); 217_newlineIndex = _lineBuffer.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF); 293return _lineBuffer.AsSpan(_newlineIndex, _lineLength - (_newlineIndex - _lineOffset)).StartsWith(CRLF) ? 2 : 1; 313_lineBuffer.AsSpan(_lineOffset, _lineLength).CopyTo(_lineBuffer); 334ReadOnlySpan<byte> line = _lineBuffer.AsSpan(_lineOffset, _newlineIndex - _lineOffset); 343T data = _itemParser(_eventType ?? SseParser.EventTypeDefault, _dataBuffer.AsSpan(0, _dataLength)); 392ReadOnlySpan<byte> remainder = _lineBuffer.AsSpan(_newlineIndex + newlineLength, _lineLength - line.Length - newlineLength); 550if (_lineBuffer.AsSpan(0, _lineLength).StartsWith(Utf8Bom))
System.Collections (1)
System\Collections\Generic\PriorityQueue.cs (1)
880ReadOnlySpan<(TElement Element, TPriority Priority)> nodes = _nodes.AsSpan(0, _size);
System.Collections.Immutable (9)
System\Collections\Frozen\FrozenHashTable.cs (2)
66Span<int> bucketStarts = arrayPoolBuckets.AsSpan(0, numBuckets); 67Span<int> nexts = arrayPoolBuckets.AsSpan(numBuckets, hashCodes.Length);
System\Collections\Frozen\Int32\Int32FrozenDictionary.cs (1)
32Span<int> hashCodes = arrayPoolHashCodes.AsSpan(0, entries.Length);
System\Collections\Frozen\ItemsFrozenSet.cs (1)
27Span<int> hashCodes = arrayPoolHashCodes.AsSpan(0, entries.Length);
System\Collections\Frozen\KeysAndValuesFrozenDictionary.cs (1)
29Span<int> hashCodes = arrayPoolHashCodes.AsSpan(0, entries.Length);
System\Collections\Frozen\String\LengthBuckets.cs (1)
46buckets.AsSpan(0, arraySize).Fill(-1);
System\Collections\Frozen\String\OrdinalStringFrozenDictionary.cs (1)
44Span<int> hashCodes = arrayPoolHashCodes.AsSpan(0, keys.Length);
System\Collections\Frozen\String\OrdinalStringFrozenSet.cs (1)
35Span<int> hashCodes = arrayPoolHashCodes.AsSpan(0, entries.Length);
System\Collections\Immutable\ImmutableArray_1.Builder.cs (1)
972_elements.AsSpan(0, _count).Sort(comparison);
System.Console (4)
System\IO\KeyParser.cs (4)
56ReadOnlySpan<char> input = buffer.AsSpan(startIndex, endIndex - startIndex); 73if (!terminfoDb.TryGetValue(buffer.AsSpan(startIndex, MinimalSequenceLength), out parsed)) 107if (!terminfoDb.TryGetValue(buffer.AsSpan(startIndex, 4), out parsed)) 132if (!terminfoDb.TryGetValue(buffer.AsSpan(startIndex, sequenceLength), out parsed))
System.Data.Common (4)
System\Data\SQLTypes\SQLBytes.cs (4)
313return ReadNoValidation(offset, buffer.AsSpan(offsetInBuffer, count)); 389WriteNoValidation(offset, buffer.AsSpan(offsetInBuffer, count)); 422Span<byte> span = _rgbBuf.AsSpan((int)offset, buffer.Length); 733return ReadNoValidation(buffer.AsSpan(offset, count));
System.Data.Odbc (3)
System\Data\Odbc\OdbcHandle.cs (3)
191sqlState = new string(buffer.AsSpan(0, buffer.AsSpan().IndexOf('\0'))); 211sqlState = new string(buffer.AsSpan(0, buffer.AsSpan().IndexOf('\0'))); 217messageBuilder.Append(new string(message.AsSpan(0, message.AsSpan().IndexOf('\0'))));
System.Diagnostics.DiagnosticSource (2)
System\Diagnostics\Metrics\TagList.netcore.cs (2)
199_overflowTags.AsSpan(index, _tagsCount - index).CopyTo(_overflowTags.AsSpan(index + 1)); 308_overflowTags is not null ? _overflowTags.AsSpan(0, _tagsCount) :
System.Diagnostics.Process (7)
System\Diagnostics\Process.Multiplexing.cs (5)
60string standardOutput = outputEncoding.GetString(outputBuffer.AsSpan(0, outputBytesRead)); 61string standardError = errorEncoding.GetString(errorBuffer.AsSpan(0, errorBytesRead)); 106byte[] outputResult = outputBuffer.AsSpan(0, outputBytesRead).ToArray(); 107byte[] errorResult = errorBuffer.AsSpan(0, errorBytesRead).ToArray(); 274int lineEnd = buffer.AsSpan(startIndex, remaining).IndexOfAny('\r', '\n');
System\Diagnostics\Process.Multiplexing.Unix.cs (2)
231ReadOnlySpan<byte> bytes = byteBuffer.AsSpan(0, unconsumedBytesCount + bytesRead); 254done = FlushDecoderAndEmitRemainingChars(preambleChecked, encoding, decoder, byteBuffer.AsSpan(0, unconsumedBytesCount),
System.Formats.Asn1 (13)
System\Formats\Asn1\AsnCharacterStringEncodings.cs (1)
177isAllowed.AsSpan(minCharAllowed, maxCharAllowed - minCharAllowed + 1).Fill(true);
System\Formats\Asn1\AsnDecoder.BitString.cs (1)
321byte[] ret = rented.AsSpan(0, written).ToArray();
System\Formats\Asn1\AsnDecoder.NamedBitList.cs (1)
353Span<byte> valueSpan = rented.AsSpan(0, written);
System\Formats\Asn1\AsnWriter.cs (7)
157_buffer.AsSpan(0, _offset).CopyTo(destination); 209return _buffer.AsSpan(0, _offset).ToArray(); 423oldBytes?.AsSpan(0, _offset).Clear(); 438if (!tag.TryEncode(_buffer.AsSpan(_offset, spaceRequired), out int written) || 666tag.AsPrimitive().Encode(_buffer.AsSpan(lenOffset - tagLen, tagLen)); 686ReadOnlySpan<byte> src = _buffer.AsSpan(start, containedLength); 687Span<byte> dest = _buffer.AsSpan(start + requiredPadding, containedLength);
System\Formats\Asn1\AsnWriter.NamedBitList.cs (1)
207Span<byte> valueSpan = rented.AsSpan(0, requiredBytes);
System\Formats\Asn1\AsnWriter.Text.cs (2)
99Span<byte> dest = _buffer.AsSpan(_offset, size); 127WriteConstructedCerOctetString(tag, tmp.AsSpan(0, size));
System.Formats.Cbor (8)
System\Formats\Cbor\Writer\CborWriter.Array.cs (2)
84ReadOnlySpan<byte> elementEncoding = _buffer.AsSpan(_frameOffset, currentOffset - _frameOffset); 85Span<byte> target = _buffer.AsSpan(_frameOffset + bytesToShift, currentOffset - _frameOffset);
System\Formats\Cbor\Writer\CborWriter.Map.cs (4)
108_buffer.AsSpan(currentKey.Offset, _offset).Clear(); 164Span<byte> tmpSpan = tempBuffer.AsSpan(0, totalMapPayloadEncodingLength); 274return _writer._buffer.AsSpan(range.Offset, range.Length); 279return _writer._buffer.AsSpan(range.Offset, range.KeyLength);
System\Formats\Cbor\Writer\CborWriter.String.cs (2)
149utf8Encoding.GetBytes(value, _buffer.AsSpan(_offset, length)); 214Span<byte> tempSpan = tempBuffer.AsSpan(0, definiteLength);
System.Formats.Tar (7)
src\runtime\src\libraries\Common\src\System\IO\SubReadStream.cs (2)
119_superStream.ReadExactly(buffer.AsSpan(0, currentLengthToRead)); 181return Read(buffer.AsSpan(offset, count));
System\Formats\Tar\GnuSparseStream.cs (5)
162return Read(buffer.AsSpan(offset, count)); 180rented.AsSpan(0, bytesRead).CopyTo(destination); 462bytes.AsSpan(activeStart, active).CopyTo(bytes); 479int nlIdx = bytes.AsSpan(activeStart, availableStart - activeStart).IndexOf((byte)'\n'); 482ReadOnlySpan<byte> span = bytes.AsSpan(activeStart, nlIdx);
System.IO.Compression (28)
src\runtime\src\libraries\Common\src\System\IO\SubReadStream.cs (2)
119_superStream.ReadExactly(buffer.AsSpan(0, currentLengthToRead)); 181return Read(buffer.AsSpan(offset, count));
System\IO\Compression\DeflateManaged\HuffmanTree.cs (4)
83literalTreeLength.AsSpan(0, 144).Fill(8); 84literalTreeLength.AsSpan(144, 112).Fill(9); 85literalTreeLength.AsSpan(256, 24).Fill(7); 86literalTreeLength.AsSpan(280, 8).Fill(8);
System\IO\Compression\DeflateManaged\InflaterManaged.cs (4)
148public int Inflate(byte[] bytes, int offset, int length) => Inflate(bytes.AsSpan(offset, length)); 625_codeList.AsSpan(_loopCounter, repeatCount).Fill(previousCode); 643_codeList.AsSpan(_loopCounter, repeatCount).Clear(); 662_codeList.AsSpan(_loopCounter, repeatCount).Clear();
System\IO\Compression\DeflateManaged\OutputWindow.cs (2)
143_window.AsSpan(WindowSize - tailLen, tailLen).CopyTo(output); 146_window.AsSpan(copy_end - output.Length, output.Length).CopyTo(output);
System\IO\Compression\WinZipAesKeyMaterial.cs (1)
72Span<byte> passwordSpan = rentedPasswordBytes.AsSpan(0, actualByteCount);
System\IO\Compression\WinZipAesStream.cs (7)
290ReadOnlySpan<byte> keystreamSpan = _keystreamBuffer.AsSpan(_keystreamOffset, bytesToProcess); 315BinaryPrimitives.WriteUInt128LittleEndian(_keystreamBuffer.AsSpan(i, BlockSize), _counter); 361_baseStream.Write(authCode.AsSpan(0, MacSizeInBytes)); 390return Read(buffer.AsSpan(offset, count)); 486ProcessBlock(workBuffer.AsSpan(0, bytesToProcess)); 506Write(buffer.AsSpan(offset, count)); 542ProcessBlock(workBuffer.AsSpan(0, bytesToProcess));
System\IO\Compression\ZipBlocks.cs (3)
644Span<byte> extraFieldBuffer = extraFieldLength <= StackAllocationThreshold ? stackalloc byte[StackAllocationThreshold].Slice(0, extraFieldLength) : arrayPoolBuffer.AsSpan(0, extraFieldLength); 756TryParseData(field.Data.AsSpan(0, field.Size), out aesExtraField)) 1026Span<byte> collatedHeader = dynamicHeaderSize <= StackAllocationThreshold ? stackalloc byte[StackAllocationThreshold].Slice(0, dynamicHeaderSize) : arrayPoolBuffer.AsSpan(0, dynamicHeaderSize);
System\IO\Compression\ZipCryptoStream.cs (2)
285return Read(buffer.AsSpan(offset, count)); 308Write(buffer.AsSpan(offset, count));
System\IO\Compression\ZipHelper.cs (1)
106Span<byte> bufferSpan = buffer.AsSpan(0, BackwardsSeekingBufferSize);
System\IO\Compression\Zstandard\ZstandardDictionary.cs (2)
109Span<nuint> lengthsAsNuint = MemoryMarshal.Cast<byte, nuint>(lengthsArray.AsSpan(0, sampleLengths.Length * sizeof(nuint))); 146return Create(dictionaryBuffer.AsSpan(0, (int)dictSize));
System.IO.FileSystem.Watcher (5)
System\IO\FileSystemWatcher.cs (2)
753items.AsSpan(0, index).CopyTo(newItems); 769items.AsSpan(0, index).CopyTo(newItems);
System\IO\FileSystemWatcher.Linux.cs (3)
553ReadOnlySpan<WatchedDirectory> movedFromDirs = _dirBuffer.AsSpan(0, movedFromWatchCount); 758return buffer.AsSpan(offset, watchersCount); 918int lengthWithoutNullTerm = _buffer.AsSpan(position, nameLength).IndexOf((byte)'\0');
System.IO.Hashing (2)
System\IO\Hashing\NonCryptographicHashAlgorithm.cs (2)
312public override void Write(byte[] buffer, int offset, int count) => hash.Append(buffer.AsSpan(offset, count)); 325hash.Append(buffer.AsSpan(offset, count));
System.Linq (3)
System\Linq\Range.SpeedOpt.cs (1)
36FillIncrementing(array.AsSpan(arrayIndex, Count), _start);
System\Linq\Repeat.SpeedOpt.cs (1)
93array.AsSpan(arrayIndex, _count).Fill(_current);
System\Linq\SkipTake.SpeedOpt.cs (1)
145Fill(_source, array.AsSpan(arrayIndex, Count), _minIndexInclusive);
System.Memory (5)
src\runtime\src\libraries\Common\src\System\Buffers\ArrayBufferWriter.cs (2)
63public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, _index); 96_buffer.AsSpan(0, _index).Clear();
System\Buffers\ReadOnlySequenceStream.cs (1)
73return Read(buffer.AsSpan(offset, count));
System\Text\EncodingExtensions.cs (2)
204array.AsSpan(0, length).CopyTo(remainingBytes); 390array.AsSpan(0, length).CopyTo(span);
System.Net.Http (17)
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackDecoder.cs (2)
507? _headerValueOctets.AsSpan(0, _headerValueLength) 522? _headerName.AsSpan(0, _headerNameLength)
src\runtime\src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\QPack\QPackDecoder.cs (2)
594? _headerValueOctets.AsSpan(0, _headerValueLength) 604? _headerName.AsSpan(0, _headerNameLength)
src\runtime\src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (3)
203_blocks.AsSpan((int)unusedInitialBlocks, (int)usedBlocks).CopyTo(newBlockArray); 209_blocks.AsSpan((int)unusedInitialBlocks, (int)usedBlocks).CopyTo(_blocks); 212_blocks.AsSpan((int)usedBlocks, (int)unusedInitialBlocks).Clear();
System\Net\Http\Headers\HeaderUtilities.cs (1)
76ReadOnlySpan<byte> utf8 = utf8bytes.AsSpan(0, utf8length);
System\Net\Http\HttpBaseStream.cs (1)
48return Read(buffer.AsSpan(offset, count));
System\Net\Http\HttpContent.cs (5)
186string result = encoding.GetString(buffer.AsSpan(0, (int)stream.Length)[bomLength..]); 887: _lastBuffer.AsSpan(0, _totalLength); 897return _lastBuffer.AsSpan(0, _totalLength).ToArray(); 1078_lastBuffer.AsSpan(0, _lastBufferOffset).CopyTo(destination); 1113Write(buffer.AsSpan(offset, count));
System\Net\Http\SocketsHttpHandler\ConnectionPool\HttpConnectionPool.Http1.cs (1)
462Span<HttpConnection> usable = stackCopy.AsSpan(0, usableConnections);
System\Net\Http\SocketsHttpHandler\Http2Connection.cs (1)
1497ReadOnlySpan<string> headerValues = tmpHeaderValuesArray.AsSpan(0, headerValuesCount);
System\Net\Http\SocketsHttpHandler\Http3RequestStream.cs (1)
782ReadOnlySpan<string> headerValues = _headerValues.AsSpan(0, headerValuesCount);
System.Net.Http.WinHttpHandler (4)
System\Net\Http\WinHttpResponseHeaderReader.cs (2)
52ReadOnlySpan<char> nameSpan = _buffer.AsSpan(startIndex, nameLength); 94int newline = _buffer.AsSpan(pos, _length - pos).IndexOf("\r\n".AsSpan());
System\Net\Http\WinHttpResponseParser.cs (2)
44ReadOnlySpan<char> versionSpan = buffer.AsSpan(0, versionLength); 271return (knownReasonPhrase != null && knownReasonPhrase.AsSpan().SequenceEqual(buffer.AsSpan(0, bufferLength))) ?
System.Net.HttpListener (1)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
27DumpBuffer(thisOrContextObject, buffer.AsSpan(offset, count), memberName);
System.Net.Mail (11)
System\Net\Base64Stream.cs (1)
158BaseStream.Write(WriteState.Buffer.AsSpan(0, WriteState.Length));
System\Net\BufferedReadStream.cs (1)
37_storedBuffer.AsSpan(_storedOffset, read).CopyTo(buffer);
System\Net\DelegatedStream.cs (2)
135return ReadInternal(buffer.AsSpan(offset, count)); 194WriteInternal(buffer.AsSpan(offset, count));
System\Net\Mail\SmtpNegotiateAuthenticationModule.cs (1)
126unwrappedChallenge = input.AsSpan(newOffset, newLength);
System\Net\Mail\SmtpReplyReaderFactory.cs (3)
286int actual = ProcessRead(_byteBuffer!.AsSpan(start, read - start), true); 319_bufferedStream.Push(_byteBuffer!.AsSpan(start, read - start)); 328_bufferedStream.Push(_byteBuffer!.AsSpan(start, read - start));
System\Net\Mime\ByteEncoder.cs (1)
80Span<byte> bytes = buffer.AsSpan(0, bytesCount);
System\Net\Mime\EightBitStream.cs (1)
67BaseStream.Write(WriteState.Buffer.AsSpan(0, WriteState.Length));
System\Net\Mime\QEncodedStream.cs (1)
204BaseStream.Write(WriteState.Buffer.AsSpan(0, WriteState.Length));
System.Net.NameResolution (8)
System\Net\DnsResolverPal.Managed.cs (8)
421responseBuffer.AsSpan(0, responseLength), queryId, name, qtype, out Exception? validationError); 441tcpBuffer.AsSpan(0, tcpLength), queryId, name, qtype, out Exception? tcpValidationError); 449if (IsServerFailure(tcpBuffer.AsSpan(0, tcpLength))) 477if (IsServerFailure(responseBuffer.AsSpan(0, responseLength))) 742SendExactSync(socket, buffer.AsSpan(0, 2)); 745ReceiveExactSync(socket, buffer.AsSpan(0, 2)); 754ReceiveExactSync(socket, buffer.AsSpan(0, responseLength)); 931public ReadOnlySpan<byte> Span => _buffer.AsSpan(0, _length);
System.Net.Primitives (5)
System\Net\IPAddress.cs (3)
645return !IsIPv4 && _numbers.AsSpan(0, 6).SequenceEqual((ReadOnlySpan<ushort>)[0, 0, 0, 0, 0, 0xFFFF]); 705ReadOnlySpan<ushort> left = _numbers.AsSpan(0, IPAddressParserStatics.IPv6AddressShorts); 706ReadOnlySpan<ushort> right = comparand._numbers.AsSpan(0, IPAddressParserStatics.IPv6AddressShorts);
System\Net\IPAddressParser.cs (2)
191AppendSections(address.AsSpan(0, 6), destination, ref pos); 203AppendSections(address.AsSpan(0, 8), destination, ref pos);
System.Net.Quic (8)
src\runtime\src\libraries\Common\src\System\Net\MultiArrayBuffer.cs (3)
203_blocks.AsSpan((int)unusedInitialBlocks, (int)usedBlocks).CopyTo(newBlockArray); 209_blocks.AsSpan((int)unusedInitialBlocks, (int)usedBlocks).CopyTo(_blocks); 212_blocks.AsSpan((int)usedBlocks, (int)unusedInitialBlocks).Clear();
System\Net\Quic\Internal\MsQuicConfiguration.Cache.cs (2)
46bool success = certificate.TryGetCertHash(HashAlgorithmName.SHA512, certificateThumbprints.AsSpan(0, ThumbprintSize), out _); 55bool success = intermediate.TryGetCertHash(HashAlgorithmName.SHA512, certificateThumbprints.AsSpan(certCount * ThumbprintSize, ThumbprintSize), out _);
System\Net\Quic\QuicStream.Stream.cs (3)
103return Read(buffer.AsSpan(offset, count)); 127rentedBuffer.AsSpan(0, readLength).CopyTo(buffer); 166Write(buffer.AsSpan(offset, count));
System.Net.Security (20)
src\runtime\src\libraries\Common\src\Interop\Unix\System.Net.Security.Native\Interop.GssBuffer.cs (1)
37Span.CopyTo(destination.AsSpan(offset, sourceLength));
src\runtime\src\libraries\Common\src\Interop\Unix\System.Security.Cryptography.Native\Interop.OpenSsl.cs (2)
70bool success = certContext.TargetCertificate.TryGetCertHash(HashAlgorithmName.SHA512, certificateThumbprints.AsSpan(0, ThumbprintSize), out _); 76success = intermediate.TryGetCertHash(HashAlgorithmName.SHA512, certificateThumbprints.AsSpan(certCount * ThumbprintSize, ThumbprintSize), out _);
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
27DumpBuffer(thisOrContextObject, buffer.AsSpan(offset, count), memberName);
src\runtime\src\libraries\Common\src\System\Net\Security\RC4.cs (1)
70CryptographicOperations.ZeroMemory(state.AsSpan(0, 256));
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CryptoPool.cs (1)
31CryptographicOperations.ZeroMemory(array.AsSpan(0, clearSize));
src\runtime\src\libraries\Common\src\System\Text\UrlBase64Encoding.cs (1)
32ReadOnlySpan<char> source = base64.AsSpan(0, base64Len);
System\Net\NegotiateAuthenticationPal.ManagedNtlm.cs (4)
573info.Slice(0, length + 4).CopyTo(targetInfoBuffer.AsSpan(targetInfoOffset, length + 4)); 597WriteChannelBindingHash(targetInfoBuffer.AsSpan(targetInfoOffset + 4, 16)); 614return targetInfoBuffer.AsSpan(0, targetInfoOffset).ToArray(); 759hmacMic.AppendData(responseBytes.AsSpan(0, payloadOffset));
System\Net\Security\NegotiateAuthentication.cs (1)
289decodedIncomingBlob = rentedBuffer.AsSpan(0, decodedLength);
System\Net\Security\NegotiateStream.cs (3)
403!_context.VerifyIntegrityCheck(_readBuffer.AsSpan(NtlmSignatureLength, readBytes - NtlmSignatureLength), _readBuffer.AsSpan(0, NtlmSignatureLength))) 416statusCode = _context.UnwrapInPlace(_readBuffer.AsSpan(0, readBytes), out decryptedOffset, out decryptedCount, out _);
System\Net\Security\SslStreamCertificateContext.Linux.cs (1)
324if (!Interop.Crypto.X509DecodeOcspToExpiration(ret, ocspRequest, subject, issuerHandles.AsSpan(0, _privateIntermediateCertificates.Length + 1), out DateTimeOffset expiration))
System\Net\Security\TlsSession.cs (4)
1269_decryptScratch.AsSpan(0, frameSize), 1293_decryptScratch.AsSpan(decLeftoverOffset, decLeftoverLength) 1316ProcessPostHandshakeMessage(_decryptScratch.AsSpan(decLeftoverOffset, decLeftoverLength)); 1379_decryptScratch.AsSpan(decLeftoverOffset, decLeftoverLength)
System.Net.ServerSentEvents (8)
System\Net\ServerSentEvents\SseParser_1.cs (8)
124_newlineIndex = _lineBuffer.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF); 204_newlineIndex = _lineBuffer.AsSpan(searchOffset, searchLength).IndexOfAny(CR, LF); 280return _lineBuffer.AsSpan(_newlineIndex, _lineLength - (_newlineIndex - _lineOffset)).StartsWith(CRLF) ? 2 : 1; 300_lineBuffer.AsSpan(_lineOffset, _lineLength).CopyTo(_lineBuffer); 330ReadOnlySpan<byte> line = _lineBuffer.AsSpan(_lineOffset, _newlineIndex - _lineOffset); 339T data = _itemParser(_eventType ?? SseParser.EventTypeDefault, _dataBuffer.AsSpan(0, _dataLength)); 388ReadOnlySpan<byte> remainder = _lineBuffer.AsSpan(_newlineIndex + newlineLength, _lineLength - line.Length - newlineLength); 549if (_lineBuffer.AsSpan(0, _lineLength).StartsWith(Utf8Bom))
System.Net.Sockets (5)
src\runtime\src\libraries\Common\src\System\Net\Logging\NetEventSource.Common.DumpBuffer.cs (1)
27DumpBuffer(thisOrContextObject, buffer.AsSpan(offset, count), memberName);
System\Net\Sockets\UDPClient.cs (4)
395return _buffer.AsSpan(0, received).ToArray(); 632byte[] buffer = _buffer.AsSpan(0, result.ReceivedBytes).ToArray(); 658byte[] buffer = _buffer.AsSpan(0, result.ReceivedBytes).ToArray(); 854return _buffer.AsSpan(0, received).ToArray();
System.Net.WebSockets (4)
System\Net\WebSockets\Compression\WebSocketDeflater.cs (1)
68_buffer.AsSpan(0, position).CopyTo(newBuffer);
System\Net\WebSockets\Compression\WebSocketInflater.cs (2)
76_buffer.AsSpan(_position, _available).CopyTo(_buffer); 109_buffer.AsSpan(0, _available).CopyTo(newBuffer);
System\Net\WebSockets\ManagedWebSocket.cs (1)
763RandomNumberGenerator.Fill(buffer.AsSpan(offset, MaskLength));
System.Numerics.Tensors (17)
System\Numerics\Tensors\netcore\Tensor.cs (5)
260Span<T> tempSpan = tempBuffer.AsSpan(0, (int)totalLength); 3663return TensorPrimitives.IndexOfMax<T>(flat.AsSpan(0, (int)x.FlattenedLength)); 3695return TensorPrimitives.IndexOfMaxMagnitude<T>(flat.AsSpan(0, (int)x.FlattenedLength)); 3726return TensorPrimitives.IndexOfMin<T>(flat.AsSpan(0, (int)x.FlattenedLength)); 3759return TensorPrimitives.IndexOfMinMagnitude<T>(flat.AsSpan(0, (int)x.FlattenedLength));
System\Numerics\Tensors\netcore\TensorOperation.cs (1)
2761Span<T> resultBuffer = rentedBuffer._array.AsSpan(0, rank);
System\Numerics\Tensors\netcore\TensorShape.cs (11)
86destinationLengths = metadata.AsSpan(rank * 0, rank); 87destinationStrides = metadata.AsSpan(rank * 1, rank); 166stridesOrder = stridesOrderArray.AsSpan(0, rank); 291destinationLengths = metadata.AsSpan(rank * 0, rank); 292destinationStrides = metadata.AsSpan(rank * 1, rank); 340return metadata.AsSpan(rank * 0, rank); 359return metadata.AsSpan(rank * 1, rank); 711lengths = lengthsArray.AsSpan(0, rank); 768intermediateLengths = intermediateLengthsArray.AsSpan(0, rank); 1123intermediateLengths = intermediateLengthsArray.AsSpan(0, rank); 1126intermediateStrides = intermediateStridesArray.AsSpan(0, rank);
System.Private.CoreLib (61)
Internal\Runtime\CompilerHelpers\StartupCode\StartupCodeHelpers.Extensions.cs (1)
21=> s_modules.AsSpan(0, s_moduleCount);
src\runtime\src\coreclr\tools\Common\System\Collections\Generic\ArrayBuilder.cs (3)
49public readonly Span<T> AsSpan() => _items.AsSpan(0, _count); 51public readonly Span<T> AsSpan(int start) => _items.AsSpan(start, _count - start); 59return _items.AsSpan(origCount, length);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\ArrayPool.cs (1)
101array.AsSpan(0, lengthToClear).Clear();
src\runtime\src\libraries\System.Private.CoreLib\src\System\Collections\BitArray.cs (5)
438_array.AsSpan(0, GetByteArrayLengthFromBitLength(_bitLength)).Fill(0xFF); 443_array.AsSpan(0, GetByteArrayLengthFromBitLength(_bitLength)).Clear(); 805ReadOnlySpan<byte> source = _array.AsSpan(0, byteLength); 938if (_array.AsSpan(0, byteCount).ContainsAnyExcept((byte)0xFF)) 965if (_array.AsSpan(0, byteCount).ContainsAnyExcept((byte)0))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\CounterGroup.cs (1)
260foreach (DiagnosticCounter counter in _onTimerCounters.AsSpan(0, counterCount))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CompareInfo.Utf8.cs (2)
93sourceUtf16 = sourceUtf16Array.AsSpan(0, sourceMaxCharCount); 124prefixUtf16 = prefixUtf16Array.AsSpan(0, prefixMaxCharCount);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\IdnMapping.Icu.cs (1)
49return GetStringForOutput(unicodeString, unicode, outputHeap.AsSpan(0, actualLength));
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\BinaryReader.cs (1)
526_stream.ReadExactly(buffer.AsSpan(0, numBytes));
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\BinaryWriter.cs (1)
238WriteCharsCommonWithoutLengthPrefix(chars.AsSpan(index, count), useThisWriteOverride: false);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\File.cs (2)
750int n = RandomAccess.ReadAtOffset(sfh, bytes.AsSpan(index, count), index); 1277return rentedArray.AsSpan(0, bytesRead).ToArray();
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\MemoryStream.cs (1)
571_buffer.AsSpan(_origin, count).CopyTo(copy);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Strategies\BufferedFileStreamStrategy.cs (3)
330_buffer.AsSpan(_readPos, buffer.Length).CopyTo(buffer.Span); 412_buffer.AsSpan(_readPos, bytesFromBuffer).CopyTo(buffer.Span); 449_buffer.AsSpan(0, bytesFromBuffer).CopyTo(buffer.Span);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\Stream.cs (1)
852_ = ReadAtLeastCore(buffer.AsSpan(offset, count), count, throwOnEndOfStream: true);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\StreamReader.cs (6)
840ReadOnlySpan<char> charBufferSpan = _charBuffer.AsSpan(_charPos, _charLen - _charPos); 953int idxOfNewline = charBuffer.AsSpan(charPos, charLen - charPos).IndexOfAny('\r', '\n'); 962retVal = string.Concat(arrayPoolBuffer.AsSpan(0, arrayPoolBufferPos), charBuffer.AsSpan(charPos, idxOfNewline)); 994arrayPoolBuffer.AsSpan(0, arrayPoolBufferPos).CopyTo(newBuffer); 998charBuffer.AsSpan(charPos, charLen - charPos).CopyTo(arrayPoolBuffer.AsSpan(arrayPoolBufferPos));
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\StreamWriter.cs (1)
409WriteSpan(buffer.AsSpan(index, count), appendNewLine: false);
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\StringStream.cs (3)
144_pendingBytes.AsSpan(_pendingOffset, toCopy).CopyTo(buffer); 174_pendingBytes.AsSpan(0, toCopy).CopyTo(buffer); 214_pendingBytes.AsSpan(0, toCopy).CopyTo(flushTarget);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Net\WebUtility.cs (1)
383ReadOnlySpan<byte> source = value.AsSpan(offset, count);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\AsyncProfiler.cs (11)
250Span<byte> payloadSpan = eventBuffer.Data.AsSpan(eventBuffer.Index, maxPayloadLength); 315Span<byte> payloadSpan = eventBuffer.Data.AsSpan(eventBuffer.Index, MaxPayloadLength); 497Span<byte> headerSpan = eventBuffer.Data.AsSpan(0, MaxEventHeaderSize); 594Span<byte> headerSpan = buffer.AsSpan(index, MaxAsyncEventHeaderSize); 638Span<byte> headerSpan = buffer.AsSpan(index, MaxAsyncEventHeaderSize); 824Span<byte> headerSpan = eventBuffer.Data.AsSpan(0, Serializer.MaxEventHeaderSize); 845AsyncProfilerEventSource.Log.AsyncEvents(eventBuffer.Data.AsSpan(0, eventBuffer.Index)); 990Span<byte> payload = eventBuffer.Data.AsSpan(eventBuffer.Index, MaxPayloadLength); 1061Span<byte> payload = eventBuffer.Data.AsSpan(eventBuffer.Index, MaxPayloadLength); 1150eventBuffer.Index += Serializer.WriteCompressedUInt32(eventBuffer.Data.AsSpan(eventBuffer.Index, MaxPayloadLength), unwindedFrames); 1846Span<byte> callstackHeaderSpan = eventBuffer.Data.AsSpan(index, MaxCallstackHeaderSize);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\CollectionsMarshal.cs (1)
69array._array.AsSpan(0, BitArray.GetByteArrayLengthFromBitLength(array.Length));
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMapState.cs (1)
170seen.AsSpan(0, modulus).Clear();
src\runtime\src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\StringSearchValues.cs (1)
354foreach (string previous in newValues.AsSpan(start, newValuesCount - start))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\StringBuilder.cs (5)
695chunkChars.AsSpan(chunkLength, repeatCount).Fill(value); 724chunkChars.AsSpan(chunkLength, firstLength).Fill(value); 734m_ChunkChars.AsSpan(0, restLength).Fill(value); 2159ReadOnlySpan<char> remainingChunk = chunk.m_ChunkChars.AsSpan(indexInChunk, Math.Min(chunk.m_ChunkLength - indexInChunk, count)); 2284Span<char> span = chunk.m_ChunkChars.AsSpan(curInChunk, endInChunk - curInChunk);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\TranscodingStream.cs (3)
354_readBuffer.AsSpan(_readBufferOffset, bytesToReturn).CopyTo(buffer); 433_readBuffer.AsSpan(_readBufferOffset, bytesToReturn).CopyTo(buffer.Span); 508Span<char> decodedChars = scratchChars.AsSpan(0, charsWritten);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8.cs (2)
712return thisRef.AppendFormatted(array.AsSpan(0, charsWritten)); 759return thisRef.AppendFormatted(array.AsSpan(0, charsWritten));
src\runtime\src\libraries\System.Private.CoreLib\src\System\TimeZoneInfo.Unix.NonAndroid.cs (3)
278int n = RandomAccess.Read(sfh, buffer.AsSpan(index, count), index); 284if (!buffer.AsSpan(index, n).SequenceEqual(rawData.AsSpan(index, n)))
System.Private.DataContractSerialization (67)
System\Runtime\Serialization\Json\JsonEncodingStreamWrapper.cs (3)
125SupportedEncoding dataEnc = DetectEncoding(buffer.AsSpan(offset, count), out int bomLength); 205_bytes.AsSpan(_byteOffset, count).CopyTo(buffer); 445_byteCount += _stream.ReadAtLeast(_bytes.AsSpan(_byteOffset + _byteCount, count), count, throwOnEndOfStream: false);
System\Runtime\Serialization\MemoryStreamAdapter.cs (1)
63Span<byte> slicedBuffer = value.Buffer.AsSpan(value.Origin, value.Length - value.Origin);
System\Text\BinHexEncoding.cs (3)
42if (!HexConverter.TryDecodeFromUtf16(chars.AsSpan(charIndex, charCount), bytes.AsSpan(byteIndex, byteCount), out int charsProcessed)) 81HexConverter.EncodeToUtf16(bytes.AsSpan(byteIndex, byteCount), chars.AsSpan(charIndex));
System\Xml\EncodingStreamWrapper.cs (3)
285_byteCount += _stream.ReadAtLeast(_bytes.AsSpan(_byteOffset + _byteCount, count), count, throwOnEndOfStream: false); 362if (!buffer.AsSpan(0, i + 1).EndsWith("encoding"u8)) 620_bytes.AsSpan(_byteOffset, count).CopyTo(buffer);
System\Xml\UniqueId.cs (3)
76ReadOnlySpan<byte> source = guid.AsSpan(offset, guidLength); 211ToSpan(chars.AsSpan(offset, count)); 291Span<byte> destination = buffer.AsSpan(offset, guidLength);
System\Xml\ValueHandle.cs (2)
733if (encoding.TryGetChars(bytes.AsSpan(byteOffset, byteCount), chars.AsSpan(charOffset, charCount), out actualCharCount))
System\Xml\XmlBaseReader.cs (1)
1508int newCount = XmlConverter.StripWhitespace(chars.AsSpan(0, charCount));
System\Xml\XmlBaseWriter.cs (1)
765if (!XmlConverter.IsWhitespace(chars.AsSpan(offset, count)))
System\Xml\XmlBinaryReader.cs (11)
1241BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1264BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1287BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1310BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1333BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1356BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1379BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1405foreach (ref DateTime item in array.AsSpan(offset, actual)) 1434BufferReader.ReadRawArrayBytes(array.AsSpan(offset, actual)); 1440foreach (ref Guid item in array.AsSpan(offset, actual)) 1470foreach (ref TimeSpan item in array.AsSpan(offset, actual))
System\Xml\XmlBinaryWriter.cs (19)
572=> WriteTextImpl(chars.AsSpan(offset, count)); 736Span<byte> span = GetTextNodeBuffer(1 + sizeof(float), out int offset).AsSpan(offset, 1 + sizeof(float)); 761Span<byte> span = GetTextNodeBuffer(1 + sizeof(double), out int offset).AsSpan(offset, 1 + sizeof(double)); 781Span<byte> span = GetTextNodeBuffer(1 + sizeof(decimal), out int offset).AsSpan(offset, 1 + sizeof(decimal)); 813Span<byte> span = GetTextNodeBuffer(17, out int offset).AsSpan(offset, 17); 924Span<byte> span = GetBuffer(sizeof(float), out int bufferOffset).AsSpan(bufferOffset, sizeof(float)); 942Span<byte> span = GetBuffer(sizeof(double), out int bufferOffset).AsSpan(bufferOffset, sizeof(double)); 964Span<byte> span = GetBuffer(16, out int bufferOffset).AsSpan(bufferOffset, 16); 995Span<byte> bytes = GetBuffer(16, out int bufferOffset).AsSpan(bufferOffset, 16); 1300_writer.WriteBoolArray(array.AsSpan(offset, count)); 1318_writer.WriteInt16Array(array.AsSpan(offset, count)); 1336_writer.WriteInt32Array(array.AsSpan(offset, count)); 1354_writer.WriteInt64Array(array.AsSpan(offset, count)); 1372_writer.WriteFloatArray(array.AsSpan(offset, count)); 1390_writer.WriteDoubleArray(array.AsSpan(offset, count)); 1408_writer.WriteDecimalArray(array.AsSpan(offset, count)); 1426_writer.WriteDateTimeArray(array.AsSpan(offset, count)); 1444_writer.WriteGuidArray(array.AsSpan(offset, count)); 1462_writer.WriteTimeSpanArray(array.AsSpan(offset, count));
System\Xml\XmlBufferReader.cs (12)
236int read = _stream.ReadAtLeast(_buffer.AsSpan(_offsetMax, needed), needed, throwOnEndOfStream: false); 377float f = BinaryPrimitives.ReadSingleLittleEndian(GetBuffer(sizeof(float), out int offset).AsSpan(offset, sizeof(float))); 384double d = BinaryPrimitives.ReadDoubleLittleEndian(GetBuffer(sizeof(double), out int offset).AsSpan(offset, sizeof(double))); 398ReadOnlySpan<byte> bytes = buffer.AsSpan(offset, sizeof(decimal)); 496.AsSpan(_offset, dst.Length) 784return XmlConverter.IsWhitespace(_buffer.AsSpan(offset, length)); 941.AsSpan(offset, sizeof(T)); 949=> MemoryMarshal.Read<T>(_buffer.AsSpan(offset, sizeof(T))); 964=> BinaryPrimitives.ReadSingleLittleEndian(_buffer.AsSpan(offset, sizeof(float))); 967=> BinaryPrimitives.ReadDoubleLittleEndian(_buffer.AsSpan(offset, sizeof(double))); 977ReadOnlySpan<byte> bytes = _buffer.AsSpan(offset, sizeof(decimal)); 994=> new Guid(_buffer.AsSpan(offset, ValueHandleLength.Guid));
System\Xml\XmlStreamNodeWriter.cs (1)
232var buffer = GetBuffer(bytes.Length, out int offset).AsSpan(offset, bytes.Length);
System\Xml\XmlUTF8TextWriter.cs (7)
364WriteUTF8Bytes(prefixBuffer.AsSpan(prefixOffset, prefixLength)); 375WriteUTF8Bytes(localNameBuffer.AsSpan(localNameOffset, localNameLength)); 434WriteUTF8Bytes(chars.AsSpan(offset + i, j - i)); 447WriteUTF8Bytes(chars.AsSpan(offset + i, j - i)); 453WriteUTF8Bytes(chars.AsSpan(offset + i, count - i)); 463WriteUTF8Bytes(chars.AsSpan(offset, count)); 521WriteUTF8Bytes(chars.AsSpan(offset, maxEntityLength - offset));
System.Private.Reflection.Execution (3)
src\runtime\src\coreclr\tools\Common\System\Collections\Generic\ArrayBuilder.cs (3)
49public readonly Span<T> AsSpan() => _items.AsSpan(0, _count); 51public readonly Span<T> AsSpan(int start) => _items.AsSpan(start, _count - start); 59return _items.AsSpan(origCount, length);
System.Private.TypeLoader (3)
src\runtime\src\coreclr\tools\Common\System\Collections\Generic\ArrayBuilder.cs (3)
49public readonly Span<T> AsSpan() => _items.AsSpan(0, _count); 51public readonly Span<T> AsSpan(int start) => _items.AsSpan(start, _count - start); 59return _items.AsSpan(origCount, length);
System.Private.Uri (3)
System\Uri.cs (3)
4392dest.AsSpan(start, destLength - start), 4590return string.Concat(path.AsSpan(1, length - 1), extra); 4608return string.Concat(left, path.AsSpan(0, length), extra);
System.Private.Xml (20)
System\Xml\Base64Decoder.cs (3)
53Decode(chars.AsSpan(startPos, len), _buffer.AsSpan(_curIndex, _endIndex - _curIndex), out int charsDecoded, out int bytesDecoded); 72Decode(str.AsSpan(startPos, len), _buffer.AsSpan(_curIndex, _endIndex - _curIndex), out int charsDecoded, out int bytesDecoded);
System\Xml\BinaryXml\XmlBinaryReader.cs (2)
2334ReadOnlySpan<byte> srcBytes = state._data.AsSpan(state.pos, checked(cch * sizeof(char))); 3490ReadOnlySpan<byte> data = _data.AsSpan(_tokDataPos, _pos - _tokDataPos);
System\Xml\BinHexDecoder.cs (3)
53Decode(chars.AsSpan(startPos, len), _buffer.AsSpan(_curIndex, _endIndex - _curIndex), 74Decode(str.AsSpan(startPos, len), _buffer.AsSpan(_curIndex, _endIndex - _curIndex),
System\Xml\BinHexEncoder.cs (1)
23HexConverter.EncodeToUtf16(buffer.AsSpan(index, cnt), chars);
System\Xml\BinHexEncoderAsync.cs (1)
26HexConverter.EncodeToUtf16(buffer.AsSpan(index, cnt), chars);
System\Xml\Core\XmlTextReaderImpl.cs (4)
3197if (_ps.bytes.AsSpan(0, _ps.bytesUsed).StartsWith(preamble)) 3709switch (_ps.chars.AsSpan(_ps.charPos, nameEndPos - _ps.charPos)) 3827switch (_ps.chars.AsSpan(_ps.charPos, pos - _ps.charPos)) 9576AdjustLineInfo(chars.AsSpan(startPos, endPos - startPos), isNormalized, ref lineInfo);
System\Xml\Core\XmlTextReaderImplAsync.cs (2)
1276switch (_ps.chars.AsSpan(_ps.charPos, nameEndPos - _ps.charPos)) 1390switch (_ps.chars.AsSpan(_ps.charPos, pos - _ps.charPos))
System\Xml\NameTable.cs (4)
99int hashCode = string.GetHashCode(key.AsSpan(start, len)); 103if (e.hashCode == hashCode && e.str.AsSpan().SequenceEqual(key.AsSpan(start, len))) 159int hashCode = string.GetHashCode(key.AsSpan(start, len)); 163if (e.hashCode == hashCode && e.str.AsSpan().SequenceEqual(key.AsSpan(start, len)))
System.Reflection.Metadata (10)
System\Reflection\Metadata\BlobBuilder.cs (4)
53private Span<byte> Span => _buffer.AsSpan(0, Length); 237if (!left._buffer.AsSpan(leftStart, minLength).SequenceEqual(right._buffer.AsSpan(rightStart, minLength))) 795WriteBytes(buffer.AsSpan(start, byteCount));
System\Reflection\Metadata\BlobWriter.cs (6)
58return Length == other.Length && _buffer.AsSpan(_start, Length).SequenceEqual(other._buffer.AsSpan(other._start, other.Length)); 92return _buffer.AsSpan(_start + start, byteCount).ToArray(); 105return ImmutableArray.Create(_buffer.AsSpan(_start + start, byteCount)); 131_buffer.AsSpan(start, byteCount).Fill(value); 235WriteBytes(buffer.AsSpan(start, byteCount));
System.Runtime.Numerics (18)
System\Number.BigInteger.cs (1)
304Span<nuint> wholeBlockDestination = bits.AsSpan(0, wholeBlockCount);
System\Numerics\BigInteger.cs (9)
417Span<byte> limbBytes = MemoryMarshal.AsBytes(val.AsSpan(0, wholeLimbCount)); 435Span<nuint> limbSpan = val.AsSpan(0, wholeLimbCount); 496_bits = val.AsSpan(0, len).ToArray(); 786return BitOperations.IsPow2(_bits[iu]) && !_bits.AsSpan(0, iu).ContainsAnyExcept(0u); 2145sticky = bits.AsSpan(0, lowerLimbCount).ContainsAnyExcept((nuint)0); 2804Span<nuint> zd = z.AsSpan(digitShift, bits.Length); 3298return bits.AsSpan(0, bitsArrayLength - 1).ContainsAnyExcept(0u) ? bitLength : bitLength - 1; 3813if (bits.AsSpan(0, bits.Length - 1).ContainsAnyExcept(0u)) 4000if (bits.AsSpan(0, bits.Length - 1).ContainsAnyExcept(0u))
System\Numerics\BigInteger.RentedBuffer.cs (1)
42Span<nuint> resultBuffer = array.AsSpan(0, size);
System\Numerics\BigIntegerCalculator.PowMod.cs (1)
553Span<nuint> table = tablePool.AsSpan(0, totalTableLen);
System\Numerics\BigIntegerCalculator.SquMul.cs (6)
74Span<nuint> pAndQAll = pAndQAllFromPool.AsSpan(0, pAndQAllLength); 83Span<nuint> rAndZAll = rAndZAllFromPool.AsSpan(0, rAndZAllLength); 283Span<nuint> pAndQAll = pAndQAllFromPool.AsSpan(0, pAndQAllLength); 293Span<nuint> rAndZAll = rAndZAllFromPool.AsSpan(0, rAndZAllLength); 330Span<nuint> pAndQAll = pAndQAllFromPool.AsSpan(0, pAndQAllLength); 366Span<nuint> cAll = cAllFromPool.AsSpan(0, cAllLength);
System.Security.Cryptography (88)
src\runtime\src\libraries\Common\src\Interop\Windows\BCrypt\Interop.BCryptExportKey.cs (1)
105return callback(rented.AsSpan(0, numBytesNeeded));
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CngHelpers.cs (1)
168callback(buffer.AsSpan(0, numBytesNeeded));
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CngPkcs8.cs (3)
149Pkcs8Response ret = ImportPkcs8(tmp.AsSpan(0, written)); 319rented.AsSpan(0, rentWritten), 356rented.AsSpan(0, rentWritten),
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CompositeMLDsa.cs (2)
1912ReadOnlySpan<byte> publicKey = buffer.AsSpan(0, written); 1957return func(buffer.AsSpan(0, written));
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CompositeMLKem.cs (1)
2180ReadOnlySpan<byte> encapsulationKey = buffer.AsSpan(0, written);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CryptoPool.cs (1)
31CryptographicOperations.ZeroMemory(array.AsSpan(0, clearSize));
src\runtime\src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (1)
252encryptedSpan = encryptedRent.AsSpan(0, written);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsa.cs (3)
2053Span<byte> publicKey = rented.AsSpan(0, publicKeySizeInBytes); 2168return func(buffer.AsSpan(0, written)); 2214Span<byte> buffer = rent.AsSpan(0, privateKeySize);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaCng.Windows.cs (1)
379ReadOnlySpan<byte> pkcs8Source = source.AsSpan(0, len);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaImplementation.cs (2)
37Span<byte> seedSpan = rented.AsSpan(0, alg.PrivateSeedSizeInBytes); 44Span<byte> skSpan = rented.AsSpan(0, alg.PrivateKeySizeInBytes);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLDsaPkcs8.cs (2)
33Span<byte> buffer = rented.AsSpan(0, seedSize); 42Span<byte> buffer = rented.AsSpan(0, privateKeySize);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKem.cs (3)
1728Span<byte> buffer = rent.AsSpan(0, decapsulationKeySize); 1785tmp.WriteEncodedValueForCrypto(rented.AsSpan(0, written)); 1820TResult result = func(buffer.AsSpan(0, written));
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKemCng.Windows.cs (1)
272ReadCngMLKemBlob(kind, buffer.AsSpan(0, written), destination);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKemImplementation.cs (2)
28Span<byte> buffer = rented.AsSpan(0, size); 35Span<byte> buffer = rented.AsSpan(0, size);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\MLKemPkcs8.cs (2)
33Span<byte> buffer = rented.AsSpan(0, seedSize); 42Span<byte> buffer = rented.AsSpan(0, decapsulationKeySize);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (3)
216buf = rented.AsSpan(0, byteCount); 501buf = rented.AsSpan(0, byteCount); 993rentedDestination.AsSpan(0, writeOffset).CopyTo(destination);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\PemKeyHelpers.Factory.cs (2)
85Span<byte> decodedBase64 = decodeBuffer.AsSpan(0, bytesWritten); 150Span<byte> decodedBase64 = decodeBuffer.AsSpan(0, bytesWritten);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12Builder.cs (2)
188authSafeSpan = rentedAuthSafe.AsSpan(0, written); 193macSpan = rentedMac.AsSpan(0, macKey.Length);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12SafeContents.cs (2)
267CryptographicOperations.ZeroMemory(destination.AsSpan(0, written)); 451encryptedSpan = encryptedRent.AsSpan(0, written);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (1)
155I = IRented.AsSpan(0, ILen);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSACng.EncryptDecrypt.cs (1)
245byte[] ret = output.AsSpan(0, numBytesNeeded).ToArray();
src\runtime\src\libraries\Common\src\System\Security\Cryptography\RSAKeyFormatHelper.cs (1)
116AsnWriter ret = WriteSubjectPublicKeyInfo(rented.AsSpan(0, written));
src\runtime\src\libraries\Common\src\System\Security\Cryptography\SlhDsa.cs (1)
1977return func(buffer.AsSpan(0, written));
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X25519DiffieHellman.cs (2)
1495TResult result = func(buffer.AsSpan(0, written)); 1573tmp.WriteEncodedValueForCrypto(rented.AsSpan(0, written));
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X509Certificates\X509CertificateLoader.cs (1)
653stream.ReadExactly(rented.AsSpan(read, totalLength - read));
src\runtime\src\libraries\Common\src\System\Security\Cryptography\X509Certificates\X509CertificateLoader.Pkcs12.cs (2)
1009_decryptBuffer.AsSpan(saveOffset, written), 1036_decryptBuffer.AsSpan(saveOffset, _decryptBufferOffset - saveOffset));
System\Security\Cryptography\Base64Transforms.cs (4)
49Span<byte> output = outputBuffer.AsSpan(outputOffset, requiredOutputLength); 151ReadOnlySpan<byte> inputBufferSpan = inputBuffer.AsSpan(inputOffset, inputCount); 196ReadOnlySpan<byte> inputBufferSpan = inputBuffer.AsSpan(inputOffset, inputCount); 240_inputBuffer.AsSpan(0, index).CopyTo(transformBuffer);
System\Security\Cryptography\BasicSymmetricCipherLiteBCrypt.cs (1)
61rented.AsSpan(0, numBytesWritten).CopyTo(output);
System\Security\Cryptography\BasicSymmetricCipherLiteNCrypt.cs (1)
71rented.AsSpan(0, numBytesWritten).CopyTo(output);
System\Security\Cryptography\CapiHelper.Windows.cs (3)
101string providerNameString = new string(providerName.AsSpan(0, providerName.AsSpan().IndexOf('\0'))); 937encryptedData.AsSpan(0, outputCount).CopyTo(output); 959dataToBeDecrypted.AsSpan(0, decryptedDataLength).CopyTo(output);
System\Security\Cryptography\CryptoStream.cs (6)
322CryptographicOperations.ZeroMemory(_outputBuffer.AsSpan(_outputBufferIndex, bytesToCopy)); 392tempOutputBuffer.AsSpan(0, numOutputBytes).CopyTo(buffer.Span); 520CryptographicOperations.ZeroMemory(sharedBuffer.AsSpan(0, buffer.Length)); 673CryptographicOperations.ZeroMemory(rentedBuffer.AsSpan(0, inputBuffer.Length)); 705CryptographicOperations.ZeroMemory(rentedBuffer.AsSpan(0, bufferSize)); 736CryptographicOperations.ZeroMemory(rentedBuffer.AsSpan(0, bufferSize));
System\Security\Cryptography\ECDsa.cs (2)
170CryptographicOperations.ZeroMemory(rented.AsSpan(0, bytesWritten)); 452CryptographicOperations.ZeroMemory(rented.AsSpan(0, bytesWritten));
System\Security\Cryptography\HashAlgorithm.cs (2)
112CryptographicOperations.ZeroMemory(buffer.AsSpan(0, clearLimit)); 148CryptographicOperations.ZeroMemory(rented.AsSpan(0, clearLimit));
System\Security\Cryptography\HKDF.Windows.cs (1)
135infoBlob = rented.AsSpan(0, info.Length);
System\Security\Cryptography\KeyBlobHelpers.cs (1)
49target.AsSpan(0, length - bytesWritten).Clear();
System\Security\Cryptography\LiteHashProvider.cs (2)
126hash.Append(rented.AsSpan(0, read)); 157hash.Append(rented.AsSpan(0, read));
System\Security\Cryptography\LiteHashProvider.Xof.cs (1)
142hash.Append(rented.AsSpan(0, read));
System\Security\Cryptography\PemKeyHelpers.cs (2)
151Span<byte> decodedBase64 = decodeBuffer.AsSpan(0, bytesWritten); 237Span<byte> decodedBase64 = decodeBuffer.AsSpan(0, bytesWritten);
System\Security\Cryptography\Rfc2898DeriveBytes.cs (2)
86RandomNumberGenerator.Fill(_salt.AsSpan(0, saltSize)); 144return _salt.AsSpan(0, _salt.Length - sizeof(uint)).ToArray();
System\Security\Cryptography\RSA.cs (3)
748AsnWriter writer = RSAKeyFormatHelper.WriteSubjectPublicKeyInfo(rented.AsSpan(0, pkcs1Size)); 1420rentResult = rented.AsSpan(0, written).ToArray(); 1423CryptographicOperations.ZeroMemory(rented.AsSpan(0, written));
System\Security\Cryptography\SymmetricAlgorithm.cs (1)
773Span<byte> decryptBuffer = decryptRent.AsSpan(0, ciphertext.Length);
System\Security\Cryptography\UniversalCryptoDecryptor.cs (5)
90ciphertext = rentedCiphertext.AsSpan(0, inputBuffer.Length); 97ciphertext = rentedCiphertext.AsSpan(0, rentedCiphertextSize); 144written = UncheckedTransformFinalBlock(inputBuffer.AsSpan(inputOffset, inputCount), rented); 145return rented.AsSpan(0, written).ToArray(); 156int written = UncheckedTransformFinalBlock(inputBuffer.AsSpan(inputOffset, inputCount), buffer);
System\Security\Cryptography\UniversalCryptoEncryptor.cs (1)
51int written = UncheckedTransformFinalBlock(inputBuffer.AsSpan(inputOffset, inputCount), buffer);
System\Security\Cryptography\UniversalCryptoOneShot.cs (1)
168Span<byte> buffer = rentedBuffer.AsSpan(0, input.Length);
System\Security\Cryptography\UniversalCryptoTransform.cs (1)
114return UncheckedTransformBlock(inputBuffer.AsSpan(inputOffset, inputCount), outputBuffer.AsSpan(outputOffset));
System\Security\Cryptography\X509Certificates\CertificateRequest.Load.cs (1)
65rented.AsSpan(0, bytesWritten),
System\Security\Cryptography\X509Certificates\CertificateRevocationListBuilder.Load.cs (1)
281rented.AsSpan(0, bytesWritten),
System\Security\Cryptography\X509Certificates\X509Certificate2.cs (1)
2026decryptedPkcs8 = KeyFormatHelper.DecryptPkcs8(password, base64Buffer.AsSpan(0, base64Written), out int bytesRead);
System\Security\Cryptography\XmlKeyHelper.cs (1)
64ret.AsSpan(0, shift).Clear();
System.Security.Cryptography.Cose (2)
System\Security\Cryptography\Cose\CoseMultiSignMessage.cs (2)
857byte[] encodedSignProtected = buffer.AsSpan(0, bytesWritten).ToArray(); 868byte[] signature = buffer.AsSpan(0, bytesWritten).ToArray();
System.Security.Cryptography.Pkcs (14)
Internal\Cryptography\Pal\AnyOS\ManagedPal.Encrypt.cs (1)
190ReadOnlySpan<byte> content = contentInfo.Content.AsSpan(contentOffset, contentLength);
Internal\Cryptography\Pal\Windows\PkcsPalWindows.Encrypt.cs (1)
91writer.WriteOctetString(encodedContent.AsSpan(contentOffset, contentLength));
src\runtime\src\libraries\Common\src\System\Security\Cryptography\CryptoPool.cs (1)
31CryptographicOperations.ZeroMemory(array.AsSpan(0, clearSize));
src\runtime\src\libraries\Common\src\System\Security\Cryptography\KeyFormatHelper.Encrypted.cs (1)
252encryptedSpan = encryptedRent.AsSpan(0, written);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\PasswordBasedEncryption.cs (3)
216buf = rented.AsSpan(0, byteCount); 501buf = rented.AsSpan(0, byteCount); 993rentedDestination.AsSpan(0, writeOffset).CopyTo(destination);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12Builder.cs (2)
188authSafeSpan = rentedAuthSafe.AsSpan(0, written); 193macSpan = rentedMac.AsSpan(0, macKey.Length);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs\Pkcs12SafeContents.cs (2)
267CryptographicOperations.ZeroMemory(destination.AsSpan(0, written)); 451encryptedSpan = encryptedRent.AsSpan(0, written);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\Pkcs12Kdf.cs (1)
155I = IRented.AsSpan(0, ILen);
System\Security\Cryptography\Pkcs\SignedCms.cs (1)
262return rented.AsSpan(0, bytesWritten).ToArray();
System\Security\Cryptography\Pkcs\SignerInfo.cs (1)
796return verify(state, rented.AsSpan(0, contentToVerifyLength));
System.Text.Encodings.Web (2)
System\Text\Encodings\Web\TextEncoder.cs (2)
252int indexOfFirstCharToEncode = FindFirstCharacterToEncode(value.AsSpan(startIndex, characterCount)); 261EncodeCore(output, value.AsSpan(startIndex + indexOfFirstCharToEncode, characterCount - indexOfFirstCharToEncode));
System.Text.Json (19)
System\Text\Json\Document\JsonDocument.cs (1)
80extraRentedBytes.AsSpan(0, length).Clear();
System\Text\Json\Document\JsonDocument.MetadataDb.cs (3)
180_data = _data.AsSpan(0, Length).ToArray(); 308Span<byte> data = _data.AsSpan(0, Length); 375_data.AsSpan(startIndex, length).CopyTo(newDatabase);
System\Text\Json\Document\JsonDocument.Parse.cs (8)
101utf8Bytes.AsSpan(0, length).Clear(); 302utf8Bytes.AsSpan(0, expectedByteCount).Clear(); 325utf8Bytes.AsSpan(0, expectedByteCount).Clear(); 648Span<byte> rentedSpan = rented.AsSpan(0, length); 836utf8Bom.SequenceEqual(rented.AsSpan(0, utf8Bom.Length))) 863rented.AsSpan(0, written).Clear(); 916JsonConstants.Utf8Bom.SequenceEqual(rented.AsSpan(0, utf8BomLength))) 945rented.AsSpan(0, written).Clear();
System\Text\Json\Document\JsonDocument.TryGetProperty.cs (2)
83utf8Name = tmpUtf8.AsSpan(0, len); 206rented.AsSpan(0, written).Clear();
System\Text\Json\JsonHelpers.Escaping.cs (1)
90utf8Value.CopyTo(propertySection.AsSpan(1, length));
System\Text\Json\Serialization\Metadata\ReflectionMemberAccessor.cs (1)
56return arguments => (T)invoker.Invoke(arguments.AsSpan(0, parameterCount));
System\Text\Json\Serialization\StreamReadBufferState.cs (2)
163_buffer.AsSpan(_offset, _count), 181if (_buffer.AsSpan(0, _count).StartsWith(JsonConstants.Utf8Bom))
System\Text\Json\Writer\JsonWriterHelper.cs (1)
316? (rented = ArrayPool<byte>.Shared.Rent(quotedLength)).AsSpan(0, quotedLength)
System.Text.RegularExpressions (5)
System\Text\RegularExpressions\Symbolic\MintermClassifier.cs (2)
54Span<object> charRangesPerMinterm = arrayPoolArray.AsSpan(0, minterms.Length); 88lookup.AsSpan((int)start, (int)(end + 1 - start)).Fill(T.CreateTruncating(mintermId));
System\Text\RegularExpressions\Symbolic\SymbolicRegexMatcher.Automata.cs (2)
137return _dfaDelta.AsSpan(state.Id << _mintermsLog, numMinterms); 156return _nfaDelta.AsSpan(nfaState << _mintermsLog, numMinterms);
System\Text\StructListBuilder.cs (1)
27public Span<T> AsSpan() => _array.AsSpan(0, _count);
System.Transactions.Local (4)
System\Transactions\Oletx\OletxEnlistment.cs (1)
106_transactionGuid = new Guid(_proxyPrepareInfoByteArray.AsSpan(0, 16));
System\Transactions\Oletx\OletxResourceManager.cs (1)
357var rmGuid = new Guid(prepareInfo.AsSpan(16, 16));
System\Transactions\TransactionInterop.cs (2)
122var txId = new Guid(cookie.AsSpan(16, 16)); 246var txId = new Guid(propagationToken.AsSpan(8, 16));
System.Web.HttpUtility (4)
System\Web\Util\HttpEncoder.cs (4)
205return UrlDecode(bytes.AsSpan(offset, count)); 398return UrlEncode(bytes.AsSpan(offset, count)); 574foreach (byte b in bytes.AsSpan(0, utf8Length)) 591chars.AsSpan(0, charCount),
System.Windows.Forms.Design (2)
System\ComponentModel\Design\ByteViewer.cs (2)
262return _dataBuf.AsSpan(offset, length); 343Encoding.Unicode.GetChars(_dataBuf.AsSpan(i, 2), new Span<char>(ref unicodeChar));
System.Xaml (3)
src\wpf\src\Microsoft.DotNet.Wpf\src\Shared\MS\Utility\FrugalList.cs (3)
1352_entries.AsSpan(0, _count).Clear(); 1503public override T[] ToArray() => _entries.AsSpan(0, _count).ToArray(); 1505public override void CopyTo(T[] array, int index) => _entries.AsSpan(0, _count).CopyTo(array.AsSpan(index));