From 20a33da60ed9d307ac48cb50c3d4723ffab228a2 Mon Sep 17 00:00:00 2001 From: Bradley Grainger Date: Thu, 6 Jun 2019 06:29:10 -0700 Subject: [PATCH] Improve ReadOnlySequence.Slice docs (dotnet/corefx#38150) * Improve ReadOnlySequence.Slice docs. Fixes dotnet/corefx#32021 * Synchronise documentation with dotnet-api-docs. Commit migrated from https://github.com/dotnet/corefx/commit/7626863d5a48f771513f7d22977189aab14dcd0b --- .../src/System/Buffers/ReadOnlySequence.cs | 41 +++++++++++++--------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/src/libraries/System.Memory/src/System/Buffers/ReadOnlySequence.cs b/src/libraries/System.Memory/src/System/Buffers/ReadOnlySequence.cs index 5df271d..ab48648 100644 --- a/src/libraries/System.Memory/src/System/Buffers/ReadOnlySequence.cs +++ b/src/libraries/System.Memory/src/System/Buffers/ReadOnlySequence.cs @@ -183,10 +183,11 @@ namespace System.Buffers } /// - /// Forms a slice out of the given , beginning at , with items + /// Forms a slice out of the current , beginning at , with items. /// /// The index at which to begin this slice. - /// The length of the slice + /// The length of the slice. + /// A slice that consists of elements from the current instance starting at index . public ReadOnlySequence Slice(long start, long length) { if (start < 0 || length < 0) @@ -258,10 +259,11 @@ namespace System.Buffers } /// - /// Forms a slice out of the given , beginning at , ending at (inclusive). + /// Forms a slice out of the current , beginning at and ending at (exclusive). /// /// The index at which to begin this slice. - /// The end (inclusive) of the slice + /// The ending (exclusive) of the slice. + /// A slice that consists of items from the index to, but not including, the sequence position in the current read-only sequence. public ReadOnlySequence Slice(long start, SequencePosition end) { if (start < 0) @@ -330,10 +332,11 @@ namespace System.Buffers } /// - /// Forms a slice out of the given , beginning at , with items + /// Forms a slice out of the current , beginning at , with items. /// /// The starting (inclusive) at which to begin this slice. - /// The length of the slice + /// The length of the slice. + /// A slice that consists of elements from the current instance starting at sequence position . public ReadOnlySequence Slice(SequencePosition start, long length) { // Check start before length @@ -406,31 +409,35 @@ namespace System.Buffers } /// - /// Forms a slice out of the given , beginning at , with items + /// Forms a slice out of the current , beginning at , with items. /// /// The index at which to begin this slice. - /// The length of the slice + /// The length of the slice. + /// A slice that consists of elements from the current instance starting at index . public ReadOnlySequence Slice(int start, int length) => Slice((long)start, length); /// - /// Forms a slice out of the given , beginning at , ending at (inclusive). + /// Forms a slice out of the current , beginning at and ending at (exclusive). /// /// The index at which to begin this slice. - /// The end (inclusive) of the slice + /// The ending (exclusive) of the slice. + /// A slice that consists of items from the index to, but not including, the sequence position in the current read-only sequence. public ReadOnlySequence Slice(int start, SequencePosition end) => Slice((long)start, end); /// - /// Forms a slice out of the given , beginning at ', with items + /// Forms a slice out of the current , beginning at , with items. /// /// The starting (inclusive) at which to begin this slice. - /// The length of the slice + /// The length of the slice. + /// A slice that consists of elements from the current instance starting at sequence position . public ReadOnlySequence Slice(SequencePosition start, int length) => Slice(start, (long)length); /// - /// Forms a slice out of the given , beginning at , ending at (inclusive). + /// Forms a slice out of the given , beginning at , ending at (exclusive). /// /// The starting (inclusive) at which to begin this slice. - /// The ending (inclusive) of the slice + /// The ending (exclusive) of the slice. + /// A slice that consists of items from the sequence position to, but not including, the sequence position in the current read-only sequence. [MethodImpl(MethodImplOptions.AggressiveInlining)] public ReadOnlySequence Slice(SequencePosition start, SequencePosition end) { @@ -439,9 +446,10 @@ namespace System.Buffers } /// - /// Forms a slice out of the given , beginning at , ending at the existing 's end. + /// Forms a slice out of the current , beginning at a specified sequence position and continuing to the end of the read-only sequence. /// /// The starting (inclusive) at which to begin this slice. + /// A slice starting at sequence position and continuing to the end of the current read-only sequence. [MethodImpl(MethodImplOptions.AggressiveInlining)] public ReadOnlySequence Slice(SequencePosition start) { @@ -450,9 +458,10 @@ namespace System.Buffers } /// - /// Forms a slice out of the given , beginning at , ending at the existing 's end. + /// Forms a slice out of the current , beginning at a specified index and continuing to the end of the read-only sequence. /// /// The start index at which to begin this slice. + /// A slice starting at index and continuing to the end of the current read-only sequence. public ReadOnlySequence Slice(long start) { if (start < 0) -- 2.7.4