Skip to content

I suggest to add ReadOnlySequence constructor for ArraySegment #25729

Closed
@AlexRadch

Description

@AlexRadch

I suggest to add ReadOnlySequence constructor for ArraySegment.

Proposed API

    public readonly partial struct ReadOnlySequence<T>
    {
        /// <summary>
        /// Creates an instance of <see cref="ReadOnlySequence{T}"/> from the <see cref="ArraySegment{T}"/>.
        /// </summary>
        public ReadOnlySequence(ArraySegment<T> arraySegment);
    }

Details

Now we have three types for buffers: Array, ArraySegment, Memory. ReadOnlySequence have constructor for two of them, so it seems convenient to have constructor for ArraySegment too.

It is just sugar for public ReadOnlySequence(T[] array, int start, int length); constructor for ArraySegment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-needs-workAPI needs work before it is approved, it is NOT ready for implementationarea-System.Memory

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions