Table of Contents

Class ReadOnlySequenceExtensions

Namespace
Nerdbank.Streams
Assembly
Nerdbank.Streams.dll

Extension methods for the ReadOnlySequence<T> type.

public static class ReadOnlySequenceExtensions
Inheritance
ReadOnlySequenceExtensions
Inherited Members

Methods

Clone<T>(ReadOnlySequence<T>)

Copies the content of one ReadOnlySequence<T> to another that is backed by its own memory buffers.

public static ReadOnlySequence<T> Clone<T>(this ReadOnlySequence<T> template)

Parameters

template ReadOnlySequence<T>

The sequence to copy from.

Returns

ReadOnlySequence<T>

A shallow copy of the sequence, backed by buffers which will never be recycled.

Type Parameters

T

The type of element in the sequence.

Remarks

This method is useful for retaining data that is backed by buffers that will be reused later.

SequenceEqual<T>(in ReadOnlySequence<T>, in ReadOnlySequence<T>)

Compares the contents of two ReadOnlySequence<T> instances for equality.

public static bool SequenceEqual<T>(this in ReadOnlySequence<T> left, in ReadOnlySequence<T> right)

Parameters

left ReadOnlySequence<T>

The first sequence.

right ReadOnlySequence<T>

The second sequence.

Returns

bool

true if the sequences have equal content; false otherwise.

Type Parameters

T

The type of element stored in the sequences.

Remarks

The underlying buffers need not be reference equal, nor must the segments in the sequences be of the same size.