-
Notifications
You must be signed in to change notification settings - Fork 5.4k
API proposal: SequenceEqual implementations for ReadOnlySequence<T> #518
Copy link
Copy link
Open
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Memory
Milestone
Description
I think it's rather unfortunate that ReadOnlySequences cannot be easily checked for value equality. The framework has such extension methods for Spans and ReadOnlySpans - SequenceEqual and the type that has Sequence in its name doesn't.
Implementing it efficiently is tricky because one needs to consider that segments may not be of the same size and even there can be empty segments that need to be ignored.
Proposed API
class MemoryExtensions
{
static bool SequenceEqual<T>(this in ReadOnlySequence<T> x, in ReadOnlySequence<T> y);
static bool SequenceEqual<T>(this in ReadOnlySequence<T> x, in ReadOnlySpan<T> y);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api-suggestionEarly API idea and discussion, it is NOT ready for implementationEarly API idea and discussion, it is NOT ready for implementationarea-System.Memory