Skip to content

Commit 283c44c

Browse files
committed
Fix some doc comments
Fixes: - formatting - inconsistencies - grammar - wrapping - code examples for following operators: - Interleave - Lag - Lead - Permutations - Slice - SortedMerge - Subsets - Window
1 parent f6bc02a commit 283c44c

File tree

9 files changed

+397
-251
lines changed

9 files changed

+397
-251
lines changed

MoreLinq/Extensions.g.cs

Lines changed: 193 additions & 122 deletions
Large diffs are not rendered by default.

MoreLinq/Interleave.cs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,31 @@ namespace MoreLinq
2424
public static partial class MoreEnumerable
2525
{
2626
/// <summary>
27-
/// Interleaves the elements of two or more sequences into a single sequence, skipping sequences as they are consumed
27+
/// Interleaves the elements of two or more sequences into a single sequence, skipping
28+
/// sequences as they are consumed.
2829
/// </summary>
30+
/// <typeparam name="T">The type of the elements of the source sequences.</typeparam>
31+
/// <param name="sequence">The first sequence in the interleave group.</param>
32+
/// <param name="otherSequences">The other sequences in the interleave group.</param>
33+
/// <returns>A sequence of interleaved elements from all of the source sequences.</returns>
2934
/// <remarks>
30-
/// Interleave combines sequences by visiting each in turn, and returning the first element of each, followed
31-
/// by the second, then the third, and so on. So, for example:<br/>
35+
/// <para>
36+
/// Interleave combines sequences by visiting each in turn, and returning the first element
37+
/// of each, followed by the second, then the third, and so on. So, for example:</para>
3238
/// <code><![CDATA[
33-
/// {1,1,1}.Interleave( {2,2,2}, {3,3,3} ) => { 1,2,3,1,2,3,1,2,3 }
39+
/// var xs = new[] { 1, 1, 1 }.Interleave(new[] { 2, 2, 2 }, new[] { 3, 3, 3 });
40+
/// // xs = { 1, 2, 3, 1, 2, 3, 1, 2, 3 }
3441
/// ]]></code>
35-
/// This operator behaves in a deferred and streaming manner.<br/>
36-
/// When sequences are of unequal length, this method will skip those sequences that have been fully consumed
37-
/// and continue interleaving the remaining sequences.<br/>
38-
/// The sequences are interleaved in the order that they appear in the <paramref name="otherSequences"/>
39-
/// collection, with <paramref name="sequence"/> as the first sequence.
42+
/// <para>
43+
/// This operator behaves in a deferred and streaming manner.</para>
44+
/// <para>
45+
/// When sequences are of unequal length, this method will skip those sequences that have
46+
/// been fully consumed and continue interleaving the remaining sequences.</para>
47+
/// <para>
48+
/// The sequences are interleaved in the order that they appear in the <paramref
49+
/// name="otherSequences"/> collection, with <paramref name="sequence"/> as the first
50+
/// sequence.</para>
4051
/// </remarks>
41-
/// <typeparam name="T">The type of the elements of the source sequences</typeparam>
42-
/// <param name="sequence">The first sequence in the interleave group</param>
43-
/// <param name="otherSequences">The other sequences in the interleave group</param>
44-
/// <returns>A sequence of interleaved elements from all of the source sequences</returns>
4552

4653
public static IEnumerable<T> Interleave<T>(this IEnumerable<T> sequence, params IEnumerable<T>[] otherSequences)
4754
{

MoreLinq/Lag.cs

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,26 @@ namespace MoreLinq
2424
public static partial class MoreEnumerable
2525
{
2626
/// <summary>
27-
/// Produces a projection of a sequence by evaluating pairs of elements separated by a negative offset.
27+
/// Produces a projection of a sequence by evaluating pairs of elements separated by a
28+
/// negative offset.
2829
/// </summary>
30+
/// <typeparam name="TSource">The type of the elements of the source sequence.</typeparam>
31+
/// <typeparam name="TResult">The type of the elements of the result sequence.</typeparam>
32+
/// <param name="source">The sequence over which to evaluate lag.</param>
33+
/// <param name="offset">The offset (expressed as a positive number) by which to lag each
34+
/// value of the sequence.</param>
35+
/// <param name="resultSelector">A projection function which accepts the current and lagged
36+
/// items (in that order) and returns a result.</param>
37+
/// <returns>
38+
/// A sequence produced by projecting each element of the sequence with its lagged
39+
/// pairing.</returns>
2940
/// <remarks>
30-
/// This operator evaluates in a deferred and streaming manner.<br/>
31-
/// For elements prior to the lag offset, <c>default(T)</c> is used as the lagged value.<br/>
41+
/// <para>
42+
/// This operator evaluates in a deferred and streaming manner.</para>
43+
/// <para>
44+
/// For elements prior to the lag offset, <c>default(T)</c> is used as the lagged
45+
/// value.</para>
3246
/// </remarks>
33-
/// <typeparam name="TSource">The type of the elements of the source sequence</typeparam>
34-
/// <typeparam name="TResult">The type of the elements of the result sequence</typeparam>
35-
/// <param name="source">The sequence over which to evaluate lag</param>
36-
/// <param name="offset">The offset (expressed as a positive number) by which to lag each value of the sequence</param>
37-
/// <param name="resultSelector">A projection function which accepts the current and lagged items (in that order) and returns a result</param>
38-
/// <returns>A sequence produced by projecting each element of the sequence with its lagged pairing</returns>
3947

4048
public static IEnumerable<TResult> Lag<TSource, TResult>(this IEnumerable<TSource> source, int offset, Func<TSource, TSource?, TResult> resultSelector)
4149
{
@@ -47,18 +55,24 @@ public static IEnumerable<TResult> Lag<TSource, TResult>(this IEnumerable<TSourc
4755
}
4856

4957
/// <summary>
50-
/// Produces a projection of a sequence by evaluating pairs of elements separated by a negative offset.
58+
/// Produces a projection of a sequence by evaluating pairs of elements separated by a
59+
/// negative offset.
5160
/// </summary>
61+
/// <typeparam name="TSource">The type of the elements of the source sequence.</typeparam>
62+
/// <typeparam name="TResult">The type of the elements of the result sequence.</typeparam>
63+
/// <param name="source">The sequence over which to evaluate lag.</param>
64+
/// <param name="offset">The offset (expressed as a positive number) by which to lag each
65+
/// value of the sequence.</param>
66+
/// <param name="defaultLagValue">A default value supplied for the lagged value prior to the
67+
/// lag offset.</param>
68+
/// <param name="resultSelector">A projection function which accepts the current and lagged
69+
/// items (in that order) and returns a result.</param>
70+
/// <returns>
71+
/// A sequence produced by projecting each element of the sequence with its lagged
72+
/// pairing.</returns>
5273
/// <remarks>
53-
/// This operator evaluates in a deferred and streaming manner.<br/>
74+
/// This operator evaluates in a deferred and streaming manner.
5475
/// </remarks>
55-
/// <typeparam name="TSource">The type of the elements of the source sequence</typeparam>
56-
/// <typeparam name="TResult">The type of the elements of the result sequence</typeparam>
57-
/// <param name="source">The sequence over which to evaluate lag</param>
58-
/// <param name="offset">The offset (expressed as a positive number) by which to lag each value of the sequence</param>
59-
/// <param name="defaultLagValue">A default value supplied for the lagged value prior to the lag offset</param>
60-
/// <param name="resultSelector">A projection function which accepts the current and lagged items (in that order) and returns a result</param>
61-
/// <returns>A sequence produced by projecting each element of the sequence with its lagged pairing</returns>
6276

6377
public static IEnumerable<TResult> Lag<TSource, TResult>(this IEnumerable<TSource> source, int offset, TSource defaultLagValue, Func<TSource, TSource, TResult> resultSelector)
6478
{

MoreLinq/Lead.cs

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,26 @@ namespace MoreLinq
2424
public static partial class MoreEnumerable
2525
{
2626
/// <summary>
27-
/// Produces a projection of a sequence by evaluating pairs of elements separated by a positive offset.
27+
/// Produces a projection of a sequence by evaluating pairs of elements separated by a
28+
/// positive offset.
2829
/// </summary>
30+
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
31+
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
32+
/// <param name="source">The sequence over which to evaluate lead.</param>
33+
/// <param name="offset">The offset (expressed as a positive number) by which to lead each
34+
/// element of the sequence.</param>
35+
/// <param name="resultSelector">A projection function which accepts the current and
36+
/// subsequent (lead) element (in that order) and produces a result.</param>
37+
/// <returns>
38+
/// A sequence produced by projecting each element of the sequence with its lead
39+
/// pairing.</returns>
2940
/// <remarks>
30-
/// This operator evaluates in a deferred and streaming manner.<br/>
31-
/// For elements of the sequence that are less than <paramref name="offset"/> items from the end,
32-
/// default(T) is used as the lead value.<br/>
41+
/// <para>
42+
/// This operator evaluates in a deferred and streaming manner.</para>
43+
/// <para>
44+
/// For elements of the sequence that are less than <paramref name="offset"/> items from the
45+
/// end, <c>default(T)</c> is used as the lead value.</para>
3346
/// </remarks>
34-
/// <typeparam name="TSource">The type of the elements in the source sequence</typeparam>
35-
/// <typeparam name="TResult">The type of the elements in the result sequence</typeparam>
36-
/// <param name="source">The sequence over which to evaluate Lead</param>
37-
/// <param name="offset">The offset (expressed as a positive number) by which to lead each element of the sequence</param>
38-
/// <param name="resultSelector">A projection function which accepts the current and subsequent (lead) element (in that order) and produces a result</param>
39-
/// <returns>A sequence produced by projecting each element of the sequence with its lead pairing</returns>
4047

4148
public static IEnumerable<TResult> Lead<TSource, TResult>(this IEnumerable<TSource> source, int offset, Func<TSource, TSource?, TResult> resultSelector)
4249
{
@@ -48,18 +55,24 @@ public static IEnumerable<TResult> Lead<TSource, TResult>(this IEnumerable<TSour
4855
}
4956

5057
/// <summary>
51-
/// Produces a projection of a sequence by evaluating pairs of elements separated by a positive offset.
58+
/// Produces a projection of a sequence by evaluating pairs of elements separated by a
59+
/// positive offset.
5260
/// </summary>
61+
/// <typeparam name="TSource">The type of the elements in the source sequence.</typeparam>
62+
/// <typeparam name="TResult">The type of the elements in the result sequence.</typeparam>
63+
/// <param name="source">The sequence over which to evaluate Lead.</param>
64+
/// <param name="offset">The offset (expressed as a positive number) by which to lead each
65+
/// element of the sequence.</param>
66+
/// <param name="defaultLeadValue">A default value supplied for the leading element when
67+
/// none is available.</param>
68+
/// <param name="resultSelector">A projection function which accepts the current and
69+
/// subsequent (lead) element (in that order) and produces a result.</param>
70+
/// <returns>
71+
/// A sequence produced by projecting each element of the sequence with its lead
72+
/// pairing.</returns>
5373
/// <remarks>
54-
/// This operator evaluates in a deferred and streaming manner.<br/>
74+
/// This operator evaluates in a deferred and streaming manner.
5575
/// </remarks>
56-
/// <typeparam name="TSource">The type of the elements in the source sequence</typeparam>
57-
/// <typeparam name="TResult">The type of the elements in the result sequence</typeparam>
58-
/// <param name="source">The sequence over which to evaluate Lead</param>
59-
/// <param name="offset">The offset (expressed as a positive number) by which to lead each element of the sequence</param>
60-
/// <param name="defaultLeadValue">A default value supplied for the leading element when none is available</param>
61-
/// <param name="resultSelector">A projection function which accepts the current and subsequent (lead) element (in that order) and produces a result</param>
62-
/// <returns>A sequence produced by projecting each element of the sequence with its lead pairing</returns>
6376

6477
public static IEnumerable<TResult> Lead<TSource, TResult>(this IEnumerable<TSource> source, int offset, TSource defaultLeadValue, Func<TSource, TSource, TResult> resultSelector)
6578
{

MoreLinq/Permutations.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,17 +180,21 @@ IList<T> PermuteValueSet()
180180
/// <summary>
181181
/// Generates a sequence of lists that represent the permutations of the original sequence.
182182
/// </summary>
183+
/// <typeparam name="T">The type of the elements in the sequence.</typeparam>
184+
/// <param name="sequence">The original sequence to permute.</param>
185+
/// <returns>
186+
/// A sequence of lists representing permutations of the original sequence.</returns>
183187
/// <remarks>
184-
/// A permutation is a unique re-ordering of the elements of the sequence.<br/>
188+
/// <para>
189+
/// A permutation is a unique re-ordering of the elements of the sequence.</para>
190+
/// <para>
185191
/// This operator returns permutations in a deferred, streaming fashion; however, each
186192
/// permutation is materialized into a new list. There are N! permutations of a sequence,
187-
/// where N => sequence.Count().<br/>
193+
/// where N &#8658; <c>sequence.Count()</c>.</para>
194+
/// <para>
188195
/// Be aware that the original sequence is considered one of the permutations and will be
189-
/// returned as one of the results.
196+
/// returned as one of the results.</para>
190197
/// </remarks>
191-
/// <typeparam name="T">The type of the elements in the sequence</typeparam>
192-
/// <param name="sequence">The original sequence to permute</param>
193-
/// <returns>A sequence of lists representing permutations of the original sequence</returns>
194198

195199
public static IEnumerable<IList<T>> Permutations<T>(this IEnumerable<T> sequence)
196200
{

MoreLinq/Slice.cs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,28 @@ namespace MoreLinq
2424
public static partial class MoreEnumerable
2525
{
2626
/// <summary>
27-
/// Extracts a contiguous count of elements from a sequence at a particular zero-based starting index
27+
/// Extracts a contiguous count of elements from a sequence at a particular zero-based
28+
/// starting index.
2829
/// </summary>
30+
/// <typeparam name="T">The type of the elements in the source sequence.</typeparam>
31+
/// <param name="sequence">The sequence from which to extract elements.</param>
32+
/// <param name="startIndex">The zero-based index at which to begin slicing.</param>
33+
/// <param name="count">The number of items to slice out of the index.</param>
34+
/// <returns>
35+
/// A new sequence containing any elements sliced out from the source sequence.</returns>
2936
/// <remarks>
30-
/// If the starting position or count specified result in slice extending past the end of the sequence,
31-
/// it will return all elements up to that point. There is no guarantee that the resulting sequence will
32-
/// contain the number of elements requested - it may have anywhere from 0 to <paramref name="count"/>.<br/>
33-
/// This method is implemented in an optimized manner for any sequence implementing <c>IList{T}</c>.<br/>
34-
/// The result of Slice() is identical to: <c>sequence.Skip(startIndex).Take(count)</c>
37+
/// <para>
38+
/// If the starting position or count specified result in slice extending past the end of
39+
/// the sequence, it will return all elements up to that point. There is no guarantee that
40+
/// the resulting sequence will contain the number of elements requested - it may have
41+
/// anywhere from 0 to <paramref name="count"/>.</para>
42+
/// <para>
43+
/// This method is implemented in an optimized manner for any sequence implementing <see
44+
/// cref="IList{T}"/>.</para>
45+
/// <para>
46+
/// The result of <see cref="Slice{T}"/> is identical to:
47+
/// <c>sequence.Skip(startIndex).Take(count)</c></para>
3548
/// </remarks>
36-
/// <typeparam name="T">The type of the elements in the source sequence</typeparam>
37-
/// <param name="sequence">The sequence from which to extract elements</param>
38-
/// <param name="startIndex">The zero-based index at which to begin slicing</param>
39-
/// <param name="count">The number of items to slice out of the index</param>
40-
/// <returns>A new sequence containing any elements sliced out from the source sequence</returns>
4149

4250
public static IEnumerable<T> Slice<T>(this IEnumerable<T> sequence, int startIndex, int count)
4351
{

0 commit comments

Comments
 (0)