Skip to content

I suggest to add ReadOnlySequence constructor for ArraySegment #25729

Closed
@AlexRadch

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions