36 instantiations of ReadOnlySequence
Microsoft.AspNetCore.Components (1)
Microsoft.AspNetCore.Components.Forms (1)
Microsoft.AspNetCore.Components.Server (3)
Microsoft.AspNetCore.Components.Web (1)
Microsoft.AspNetCore.HttpLogging (1)
Microsoft.AspNetCore.OutputCaching (8)
OutputCacheEntryFormatter.cs (4)
49await bufferStore.SetAsync(key, new(buffer.GetCommittedMemory()), CopyToLeasedMemory(tags, out var lease), duration, cancellationToken);
319result.SetBody(new ReadOnlySequence<byte>(ReadSegment(ref reader)), recycleBuffers: false); // we're reusing the live payload buffers
329result.SetBody(new ReadOnlySequence<byte>(first, 0, last, last.Length), recycleBuffers: false); // we're reusing the live payload buffers
369result.SetBody(new(reader.ReadBytesMemory(payloadLength)), recycleBuffers: false); // we're reusing the live payload buffers
Microsoft.AspNetCore.Server.Kestrel.Core (2)
Microsoft.AspNetCore.SignalR.Common (1)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (1)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (1)
Microsoft.Extensions.Caching.Hybrid (3)
Microsoft.Extensions.Caching.Hybrid.Tests (5)
Microsoft.Extensions.Caching.StackExchangeRedis (2)
System.IO.Pipelines (2)
System.Memory (3)
System.Text.Json (1)
483 references to ReadOnlySequence
Aspire.Dashboard (1)
Aspire.Hosting (1)
Microsoft.AspNetCore.Components (4)
Microsoft.AspNetCore.Components.Forms (1)
Microsoft.AspNetCore.Components.Server (43)
Microsoft.AspNetCore.Components.Web (1)
Microsoft.AspNetCore.Http.Connections (12)
Microsoft.AspNetCore.Http.Connections.Client (8)
Microsoft.AspNetCore.HttpLogging (2)
Microsoft.AspNetCore.OutputCaching (12)
Microsoft.AspNetCore.Server.IIS (18)
Microsoft.AspNetCore.Server.Kestrel.Core (109)
Internal\Http\Http1ChunkedEncodingMessageBody.cs (10)
116var readableBuffer = result.Buffer;
205private bool Read(ReadOnlySequence<byte> readableBuffer, PipeWriter writableBuffer, out SequencePosition consumed, out SequencePosition examined)
294private void ParseChunkedPrefix(in ReadOnlySequence<byte> buffer, out SequencePosition consumed, out SequencePosition examined)
360private void ParseExtension(ReadOnlySequence<byte> buffer, out SequencePosition consumed, out SequencePosition examined)
389var suffixBuffer = buffer.Slice(extensionCursor);
431private void ReadChunkedData(in ReadOnlySequence<byte> buffer, PipeWriter writableBuffer, out SequencePosition consumed, out SequencePosition examined)
448private void ParseChunkedSuffix(in ReadOnlySequence<byte> buffer, out SequencePosition consumed, out SequencePosition examined)
458var suffixBuffer = buffer.Slice(0, 2);
476private void ParseChunkedTrailer(in ReadOnlySequence<byte> buffer, out SequencePosition consumed, out SequencePosition examined)
486var trailerBuffer = buffer.Slice(0, 2);
Internal\Http2\Http2Connection.cs (17)
325var buffer = result.Buffer;
339while (Http2FrameReader.TryReadFrame(ref buffer, _incomingFrame, _serverSettings.MaxFrameSize, out var framePayload))
558var readableBuffer = result.Buffer;
637private bool ParseHttp1x(ReadOnlySequence<byte> buffer, out HttpVersion httpVersion)
662private static bool IsPreface(in ReadOnlySequence<byte> buffer, out SequencePosition consumed, out SequencePosition examined)
669var preface = buffer.Slice(0, ClientPreface.Length);
681private Task ProcessFrameAsync<TContext>(IHttpApplication<TContext> application, in ReadOnlySequence<byte> payload) where TContext : notnull
708private Task ProcessDataFrameAsync(in ReadOnlySequence<byte> payload)
790private Task ProcessHeadersFrameAsync<TContext>(IHttpApplication<TContext> application, in ReadOnlySequence<byte> payload) where TContext : notnull
854var headersPayload = payload.Slice(0, _incomingFrame.HeadersPayloadLength); // Minus padding
887var headersPayload = payload.Slice(0, _incomingFrame.HeadersPayloadLength); // Minus padding
995private Task ProcessSettingsFrameAsync(in ReadOnlySequence<byte> payload)
1079private Task ProcessPingFrameAsync(in ReadOnlySequence<byte> payload)
1200private Task ProcessContinuationFrameAsync(in ReadOnlySequence<byte> payload)
1244private Task DecodeHeadersAsync(bool endHeaders, in ReadOnlySequence<byte> payload)
1271private Task DecodeTrailersAsync(bool endHeaders, in ReadOnlySequence<byte> payload)
1908var bufferSlice = readResult.Buffer.Slice(0, copyAmount);
Internal\Http2\Http2FrameWriter.cs (8)
193var buffer = readResult.Buffer;
563private ValueTask<FlushResult> WriteDataAndTrailersAsync(Http2Stream stream, in ReadOnlySequence<byte> data, bool writeHeaders, HttpResponseTrailers headers)
715private void WriteDataUnsynchronized(int streamId, in ReadOnlySequence<byte> data, long dataLength, bool endStream)
742void TrimAndWriteDataUnsynchronized(in ReadOnlySequence<byte> data, long dataLength, bool endStream)
750var remainingData = data;
753var currentData = remainingData.Slice(0, dataPayloadLength);
781private ValueTask<FlushResult> WriteDataAsync(Http2Stream stream, ReadOnlySequence<byte> data, long dataLength, bool endStream, bool writeHeaders)
957public ValueTask<FlushResult> WritePingAsync(Http2PingFrameFlags flags, in ReadOnlySequence<byte> payload)
Internal\Http3\Http3ControlStream.cs (9)
161var readableBuffer = result.Buffer;
264var readableBuffer = result.Buffer;
273while (Http3FrameReader.TryReadFrame(ref readableBuffer, incomingFrame, isContinuedFrame, out var framePayload))
324private ValueTask ProcessHttp3ControlStream(Http3RawFrame incomingFrame, bool isContinuedFrame, in ReadOnlySequence<byte> payload, out SequencePosition consumed)
360private ValueTask ProcessSettingsFrameAsync(bool isContinuedFrame, ReadOnlySequence<byte> payload, out SequencePosition consumed)
422private ValueTask ProcessGoAwayFrameAsync(bool isContinuedFrame, Http3RawFrame incomingFrame, ReadOnlySequence<byte> payload, out SequencePosition consumed)
444private ValueTask ProcessCancelPushFrameAsync(Http3RawFrame incomingFrame, ReadOnlySequence<byte> payload, out SequencePosition consumed)
456private ValueTask ProcessMaxPushIdFrameAsync(Http3RawFrame incomingFrame, ReadOnlySequence<byte> payload, out SequencePosition consumed)
479private static void ParseVarIntWithFrameLengthValidation(Http3RawFrame incomingFrame, ReadOnlySequence<byte> payload, out SequencePosition consumed)
Microsoft.AspNetCore.Server.Kestrel.Transport.Quic (1)
Microsoft.AspNetCore.SignalR.Client.Core (2)
Microsoft.AspNetCore.SignalR.Common (14)
Microsoft.AspNetCore.SignalR.Core (4)
Microsoft.AspNetCore.SignalR.Protocols.Json (12)
Microsoft.AspNetCore.SignalR.Protocols.MessagePack (7)
Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson (9)
Microsoft.AspNetCore.SignalR.Specification.Tests (2)
Microsoft.AspNetCore.SignalR.StackExchangeRedis (3)
Microsoft.AspNetCore.TestHost (1)
Microsoft.AspNetCore.WebUtilities (7)
Microsoft.Extensions.Caching.Abstractions (3)
Microsoft.Extensions.Caching.Hybrid (7)
Microsoft.Extensions.Caching.Hybrid.Tests (14)
Microsoft.Extensions.Caching.SqlServer (3)
Microsoft.Extensions.Caching.StackExchangeRedis (5)
RedisCache.cs (5)
131private static ReadOnlyMemory<byte> Linearize(in ReadOnlySequence<byte> value, out byte[]? lease)
158void IBufferDistributedCache.Set(string key, ReadOnlySequence<byte> value, DistributedCacheEntryOptions options)
161private void SetImpl(string key, ReadOnlySequence<byte> value, DistributedCacheEntryOptions options)
205ValueTask IBufferDistributedCache.SetAsync(string key, ReadOnlySequence<byte> value, DistributedCacheEntryOptions options, CancellationToken token)
208private async Task SetImplAsync(string key, ReadOnlySequence<byte> value, DistributedCacheEntryOptions options, CancellationToken token = default)
mscorlib (1)
netstandard (1)
System.IO.Pipelines (19)
System.Memory (120)
System\Buffers\ReadOnlySequence.cs (43)
24/// Returns empty <see cref="ReadOnlySequence{T}"/>
26public static readonly ReadOnlySequence<T> Empty = new ReadOnlySequence<T>(Array.Empty<T>());
29/// Length of the <see cref="ReadOnlySequence{T}"/>.
34/// Determines if the <see cref="ReadOnlySequence{T}"/> is empty.
39/// Determines if the <see cref="ReadOnlySequence{T}"/> contains a single <see cref="ReadOnlyMemory{T}"/> segment.
58/// A position to the start of the <see cref="ReadOnlySequence{T}"/>.
67/// A position to the end of the <see cref="ReadOnlySequence{T}"/>
91/// Creates an instance of <see cref="ReadOnlySequence{T}"/> from linked memory list represented by start and end segments
111/// Creates an instance of <see cref="ReadOnlySequence{T}"/> from the array.
125/// Creates an instance of <see cref="ReadOnlySequence{T}"/> from the array, start, and index.
141/// Creates an instance of <see cref="ReadOnlySequence{T}"/> from the <see cref="ReadOnlyMemory{T}"/>.
142/// Consumer is expected to manage lifetime of memory until <see cref="ReadOnlySequence{T}"/> is not used anymore.
184/// Forms a slice out of the current <see cref="ReadOnlySequence{T}"/>, beginning at <paramref name="start"/>, with <paramref name="length"/> items.
189public ReadOnlySequence<T> Slice(long start, long length)
260/// Forms a slice out of the current <see cref="ReadOnlySequence{T}"/>, beginning at <paramref name="start"/> and ending at <paramref name="end"/> (exclusive).
265public ReadOnlySequence<T> Slice(long start, SequencePosition end)
339/// Forms a slice out of the current <see cref="ReadOnlySequence{T}"/>, beginning at <paramref name="start"/>, with <paramref name="length"/> items.
344public ReadOnlySequence<T> Slice(SequencePosition start, long length)
422/// Forms a slice out of the current <see cref="ReadOnlySequence{T}"/>, beginning at <paramref name="start"/>, with <paramref name="length"/> items.
427public ReadOnlySequence<T> Slice(int start, int length) => Slice((long)start, length);
430/// Forms a slice out of the current <see cref="ReadOnlySequence{T}"/>, beginning at <paramref name="start"/> and ending at <paramref name="end"/> (exclusive).
435public ReadOnlySequence<T> Slice(int start, SequencePosition end) => Slice((long)start, end);
438/// Forms a slice out of the current <see cref="ReadOnlySequence{T}"/>, beginning at <paramref name="start"/>, with <paramref name="length"/> items.
443public ReadOnlySequence<T> Slice(SequencePosition start, int length) => Slice(start, (long)length);
446/// Forms a slice out of the given <see cref="ReadOnlySequence{T}"/>, beginning at <paramref name="start"/>, ending at <paramref name="end"/> (exclusive).
452public ReadOnlySequence<T> Slice(SequencePosition start, SequencePosition end)
459/// Forms a slice out of the current <see cref="ReadOnlySequence{T}" />, beginning at a specified sequence position and continuing to the end of the read-only sequence.
464public ReadOnlySequence<T> Slice(SequencePosition start)
472/// Forms a slice out of the current <see cref="ReadOnlySequence{T}" /> , beginning at a specified index and continuing to the end of the read-only sequence.
476public ReadOnlySequence<T> Slice(long start)
493ReadOnlySequence<T> localThis = this;
494ReadOnlySequence<char> charSequence = Unsafe.As<ReadOnlySequence<T>, ReadOnlySequence<char>>(ref localThis);
511/// Returns an enumerator over the <see cref="ReadOnlySequence{T}"/>
601/// Returns <code>false</code> if end of <see cref="ReadOnlySequence{T}"/> was reached otherwise <code>true</code>.
616/// An enumerator over the <see cref="ReadOnlySequence{T}"/>
620private readonly ReadOnlySequence<T> _sequence;
625/// <param name="sequence">The <see cref="ReadOnlySequence{T}"/> to enumerate.</param>
626public Enumerator(in ReadOnlySequence<T> sequence)
639/// Moves to the next <see cref="ReadOnlyMemory{T}"/> in the <see cref="ReadOnlySequence{T}"/>
665/// Flag that allows encoding the <see cref="ReadOnlySequence{T}.SequenceType"/>.
667/// <seealso cref="ReadOnlySequence{T}.GetSequenceType"/>
System\Buffers\SequenceReader.Search.cs (12)
35if (!TryReadToInternal(out ReadOnlySequence<T> sequence, delimiter, advancePastDelimiter, CurrentSpan.Length - CurrentSpanIndex))
72if (!TryReadToSlow(out ReadOnlySequence<T> sequence, delimiter, delimiterEscape, index, advancePastDelimiter))
83private bool TryReadToSlow(out ReadOnlySequence<T> sequence, T delimiter, T delimiterEscape, int index, bool advancePastDelimiter)
188public bool TryReadTo(out ReadOnlySequence<T> sequence, T delimiter, bool advancePastDelimiter = true)
193private bool TryReadToInternal(out ReadOnlySequence<T> sequence, T delimiter, bool advancePastDelimiter, int skip = 0)
239public bool TryReadTo(out ReadOnlySequence<T> sequence, T delimiter, T delimiterEscape, bool advancePastDelimiter = true)
347if (!TryReadToAnyInternal(out ReadOnlySequence<T> sequence, delimiters, advancePastDelimiter, CurrentSpan.Length - CurrentSpanIndex))
364public bool TryReadToAny(out ReadOnlySequence<T> sequence, scoped ReadOnlySpan<T> delimiters, bool advancePastDelimiter = true)
369private bool TryReadToAnyInternal(out ReadOnlySequence<T> sequence, scoped ReadOnlySpan<T> delimiters, bool advancePastDelimiter, int skip = 0)
433if (!TryReadTo(out ReadOnlySequence<T> sequence, delimiter, advancePastDelimiter))
451public bool TryReadTo(out ReadOnlySequence<T> sequence, scoped ReadOnlySpan<T> delimiter, bool advancePastDelimiter = true)
511public bool TryReadExact(int count, out ReadOnlySequence<T> sequence)
System\Text\EncodingExtensions.cs (28)
61/// Decodes the specified <see cref="ReadOnlySequence{Char}"/> to <see langword="byte"/>s using the specified <see cref="Encoding"/>
65/// <param name="chars">The <see cref="ReadOnlySequence{Char}"/> whose contents should be encoded.</param>
70public static long GetBytes(this Encoding encoding, in ReadOnlySequence<char> chars, IBufferWriter<byte> writer)
90/// Encodes the specified <see cref="ReadOnlySequence{Char}"/> to <see langword="byte"/>s using the specified <see cref="Encoding"/>
94/// <param name="chars">The <see cref="ReadOnlySequence{Char}"/> to encode to <see langword="byte"/>s.</param>
100public static int GetBytes(this Encoding encoding, in ReadOnlySequence<char> chars, Span<byte> bytes)
115ReadOnlySequence<char> remainingChars = chars;
135/// Encodes the specified <see cref="ReadOnlySequence{Char}"/> into a <see cref="byte"/> array using the specified <see cref="Encoding"/>.
138/// <param name="chars">The <see cref="ReadOnlySequence{Char}"/> to encode to <see langword="byte"/>s.</param>
142public static byte[] GetBytes(this Encoding encoding, in ReadOnlySequence<char> chars)
169ReadOnlySequence<char> remainingChars = chars;
252/// Decodes the specified <see cref="ReadOnlySequence{Byte}"/> to <see langword="char"/>s using the specified <see cref="Encoding"/>
256/// <param name="bytes">The <see cref="ReadOnlySequence{Byte}"/> whose bytes should be decoded.</param>
261public static long GetChars(this Encoding encoding, in ReadOnlySequence<byte> bytes, IBufferWriter<char> writer)
281/// Decodes the specified <see cref="ReadOnlySequence{Byte}"/> to <see langword="char"/>s using the specified <see cref="Encoding"/>
285/// <param name="bytes">The <see cref="ReadOnlySequence{Byte}"/> to decode to characters.</param>
291public static int GetChars(this Encoding encoding, in ReadOnlySequence<byte> bytes, Span<char> chars)
306ReadOnlySequence<byte> remainingBytes = bytes;
326/// Decodes the specified <see cref="ReadOnlySequence{Byte}"/> into a <see cref="string"/> using the specified <see cref="Encoding"/>.
329/// <param name="bytes">The <see cref="ReadOnlySequence{Byte}"/> to decode into characters.</param>
333public static string GetString(this Encoding encoding, in ReadOnlySequence<byte> bytes)
356ReadOnlySequence<byte> remainingBytes = bytes;
449/// Converts a <see cref="ReadOnlySequence{Char}"/> to encoded bytes and writes the result to <paramref name="writer"/>.
461public static void Convert(this Encoder encoder, in ReadOnlySequence<char> chars, IBufferWriter<byte> writer, bool flush, out long bytesUsed, out bool completed)
471ReadOnlySequence<char> remainingChars = chars;
542/// Converts a <see cref="ReadOnlySequence{Byte}"/> to UTF-16 encoded characters and writes the result to <paramref name="writer"/>.
555public static void Convert(this Decoder decoder, in ReadOnlySequence<byte> bytes, IBufferWriter<char> writer, bool flush, out long charsUsed, out bool completed)
565ReadOnlySequence<byte> remainingBytes = bytes;
System.Net.Http (3)
System.Text.Json (33)