965 references to AsSpan
Aspire.Hosting (1)
Aspire.Hosting.Docker (1)
dotnet (4)
GenerateDocumentationAndConfigFiles (7)
ILCompiler.Compiler (7)
ILCompiler.Diagnostics (6)
ILCompiler.ReadyToRun (10)
ILCompiler.RyuJit (4)
ILCompiler.TypeSystem (10)
Microsoft.AspNetCore.Antiforgery (4)
Microsoft.AspNetCore.Components (6)
Microsoft.AspNetCore.Components.Endpoints (2)
Microsoft.AspNetCore.Components.Server (11)
Microsoft.AspNetCore.Components.WebAssembly (2)
Microsoft.AspNetCore.Components.WebView (1)
Microsoft.AspNetCore.DataProtection (8)
Microsoft.AspNetCore.DataProtection.Abstractions (3)
Microsoft.AspNetCore.DataProtection.MicroBenchmarks (4)
Microsoft.AspNetCore.Diagnostics.Middleware (2)
Microsoft.AspNetCore.Http (1)
Microsoft.AspNetCore.Http.Connections (9)
Microsoft.AspNetCore.Http.Connections.Common (1)
Microsoft.AspNetCore.Http.Extensions (1)
Microsoft.AspNetCore.HttpLogging (4)
Microsoft.AspNetCore.Mvc.ApiExplorer (1)
Microsoft.AspNetCore.Mvc.ViewFeatures (3)
Microsoft.AspNetCore.OpenApi (8)
Microsoft.AspNetCore.OutputCaching (3)
Microsoft.AspNetCore.Razor.Utilities.Shared (5)
Microsoft.AspNetCore.ResponseCaching (1)
Microsoft.AspNetCore.Server.HttpSys (1)
Microsoft.AspNetCore.Server.Kestrel.Core (11)
Microsoft.AspNetCore.Server.Kestrel.Transport.DirectTls (1)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (2)
Microsoft.AspNetCore.SignalR.Common (7)
Microsoft.AspNetCore.SignalR.Protocols.Json (1)
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (6)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (7)
Microsoft.AspNetCore.SignalR.Specification.Tests (6)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (6)
Microsoft.AspNetCore.Watch.BrowserRefresh (2)
Microsoft.AspNetCore.WebUtilities (10)
Microsoft.Build (1)
Microsoft.Build.Framework (2)
Microsoft.Build.Tasks.Core (1)
Microsoft.CodeAnalysis (8)
Microsoft.CodeAnalysis.Analyzers (7)
Microsoft.CodeAnalysis.AnalyzerUtilities (7)
Microsoft.CodeAnalysis.CodeStyle (7)
Microsoft.CodeAnalysis.CSharp (1)
Microsoft.CodeAnalysis.Extensions.Package (1)
Microsoft.CodeAnalysis.Razor.Compiler (1)
Microsoft.CodeAnalysis.ResxSourceGenerator (7)
Microsoft.CodeAnalysis.Workspaces (7)
Microsoft.CSharp (1)
Microsoft.Diagnostics.DataContractReader.Contracts (4)
Microsoft.Diagnostics.DataContractReader.Legacy (4)
Microsoft.DotNet.Build.Tasks.FileCatalog (1)
Microsoft.DotNet.Build.Tasks.Installers (1)
Microsoft.DotNet.HotReload.Watch (2)
Microsoft.Extensions.AI (2)
Microsoft.Extensions.AI.Abstractions (4)
Microsoft.Extensions.AI.OpenAI (2)
Microsoft.Extensions.Caching.Hybrid (10)
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());
Microsoft.Extensions.Compliance.Abstractions (1)
Microsoft.Extensions.DependencyModel (2)
Microsoft.Extensions.Diagnostics.ResourceMonitoring (3)
Microsoft.Extensions.Diagnostics.ResourceMonitoring.Tests (1)
Microsoft.Extensions.DotNetDeltaApplier (2)
Microsoft.Extensions.Http.Diagnostics (2)
Microsoft.Extensions.Identity.Core (1)
Microsoft.Extensions.ServiceDiscovery.Dns (1)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests (4)
Microsoft.Extensions.ServiceDiscovery.Dns.Tests.Fuzzing (1)
Microsoft.Extensions.Telemetry (1)
Microsoft.JSInterop (2)
Microsoft.ML.Core (8)
Microsoft.ML.CpuMath (6)
Microsoft.ML.CpuMath.PerformanceTests (11)
Microsoft.ML.Data (15)
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);
Microsoft.ML.FastTree (9)
Microsoft.ML.PCA (1)
Microsoft.ML.StandardTrainers (3)
Microsoft.ML.TestFrameworkCommon (1)
Microsoft.ML.Tokenizers (12)
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));
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)),
Microsoft.ML.Transforms (1)
Microsoft.NET.Build.Containers (2)
Microsoft.NET.Build.Tasks (1)
Microsoft.NET.HostModel (5)
Microsoft.NET.Sdk.StaticWebAssets.Tasks (1)
NuGet.Common (1)
NuGet.ProjectModel (4)
PresentationCore (2)
PresentationFramework (6)
Roslyn.Diagnostics.Analyzers (7)
Shared (11)
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.Immutable (9)
System.Console (4)
System.Data.Common (4)
System.Data.Odbc (3)
System.Diagnostics.DiagnosticSource (2)
System.Diagnostics.Process (7)
System.Formats.Asn1 (13)
System.Formats.Cbor (8)
System.Formats.Tar (7)
System.IO.Compression (28)
System.IO.FileSystem.Watcher (5)
System.IO.Hashing (2)
System.Linq (3)
System.Memory (5)
System.Net.Http (17)
System.Net.Http.WinHttpHandler (4)
System.Net.HttpListener (1)
System.Net.Mail (11)
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.Quic (8)
System.Net.Security (20)
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)
System.Net.WebSockets (4)
System.Numerics.Tensors (17)
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)
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);
System.Private.DataContractSerialization (67)
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.Private.Reflection.Execution (3)
System.Private.TypeLoader (3)
System.Private.Uri (3)
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.Reflection.Metadata (10)
System.Runtime.Numerics (18)
System.Security.Cryptography (88)
System.Security.Cryptography.Cose (2)
System.Security.Cryptography.Pkcs (14)
System.Text.Encodings.Web (2)
System.Text.Json (19)
System.Text.RegularExpressions (5)
System.Transactions.Local (4)
System.Web.HttpUtility (4)
System.Windows.Forms.Design (2)
System.Xaml (3)