Skip to content

Commit 3a5cea5

Browse files
authored
documentation comments cleanup (#8)
- removed extra white spaces and lines - fixed incorrect type references - changed boolean code blocks to see-langword tags - added missing doc-comments - changed some type references to parameter references to remove ambiguity - added missing punctuations - reworded some comments to closer match examples in the .NET documentation - fixed some comments
1 parent ad762ff commit 3a5cea5

18 files changed

+434
-350
lines changed

src/Enumerators/Split/SpanSplitEnumerator.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,29 +5,30 @@ namespace SpanExtensions.Enumerators
55
/// <summary>
66
/// Supports iteration over a <see cref="ReadOnlySpan{T}"/> by splitting it at a specified delimiter of type <typeparamref name="T"/>.
77
/// </summary>
8-
/// <typeparam name="T">The type of elements in the enumerated <see cref="ReadOnlySpan{T}"/></typeparam>
8+
/// <typeparam name="T">The type of elements in the enumerated <see cref="ReadOnlySpan{T}"/>.</typeparam>
99
public ref struct SpanSplitEnumerator<T> where T : IEquatable<T>
1010
{
1111
ReadOnlySpan<T> Span;
1212
readonly T Delimiter;
1313

1414
/// <summary>
15-
/// Gets the element in the collection at the current position of the enumerator.
15+
/// Gets the element in the collection at the current position of the enumerator.
1616
/// </summary>
1717
public ReadOnlySpan<T> Current { get; internal set; }
1818

1919
/// <summary>
20-
/// Constructs a <see cref="SpanSplitEnumerator{T}"/> from a span and a delimiter. ONLY CONSUME THIS CLASS THROUGH <see cref="ReadOnlySpanExtensions.Split{T}(ReadOnlySpan{T}, T)"/>.
20+
/// Constructs a <see cref="SpanSplitEnumerator{T}"/> from a span and a delimiter. <strong>Only consume this class through <see cref="ReadOnlySpanExtensions.Split{T}(ReadOnlySpan{T}, T)"/></strong>.
2121
/// </summary>
22-
/// <param name="source">The <see cref="ReadOnlySpan{T}"/> to be split.</param>
23-
/// <param name="delimiter">An instance of <typeparamref name="T"/> that delimits the various sub-ReadOnlySpans in the <see cref="ReadOnlySpan{T}"/>.</param>
22+
/// <param name="source">The <see cref="ReadOnlySpan{T}"/> to be split.</param>
23+
/// <param name="delimiter">An instance of <typeparamref name="T"/> that delimits the various sub-ReadOnlySpans in <paramref name="source"/>.</param>
2424
public SpanSplitEnumerator(ReadOnlySpan<T> source, T delimiter)
2525
{
2626
Span = source;
2727
Delimiter = delimiter;
2828
Current = default;
2929
}
30-
/// <summary></summary>
30+
31+
/// <summary>Returns an enumerator that iterates through a collection.</summary>
3132
public readonly SpanSplitEnumerator<T> GetEnumerator()
3233
{
3334
return this;
@@ -36,7 +37,7 @@ public readonly SpanSplitEnumerator<T> GetEnumerator()
3637
/// <summary>
3738
/// Advances the enumerator to the next element of the collection.
3839
/// </summary>
39-
/// <returns><code>true</code> if the enumerator was successfully advanced to the next element; <code>false</code> if the enumerator has passed the end of the collection.</returns>
40+
/// <returns><see langword="true"/> if the enumerator was successfully advanced to the next element; <see langword="false"/> if the enumerator has passed the end of the collection.</returns>
4041
public bool MoveNext()
4142
{
4243
ReadOnlySpan<T> span = Span;

src/Enumerators/Split/SpanSplitStringSplitOptionsEnumerator.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,25 @@
22

33
namespace SpanExtensions.Enumerators
44
{
5-
/// <summary>
6-
/// Supports iteration over a <see cref="ReadOnlySpan{Char}"/> by splitting it at a specified delimiter and based on specified <see cref="StringSplitOptions"/>.
7-
/// </summary>
5+
/// <summary>
6+
/// Supports iteration over a <see cref="ReadOnlySpan{Char}"/> by splitting it at a specified delimiter and based on specified <see cref="StringSplitOptions"/>.
7+
/// </summary>
88
public ref struct SpanSplitStringSplitOptionsEnumerator
99
{
1010
ReadOnlySpan<char> Span;
1111
readonly char Delimiter;
1212
readonly StringSplitOptions Options;
1313

1414
/// <summary>
15-
/// Gets the element in the collection at the current position of the enumerator.
15+
/// Gets the element in the collection at the current position of the enumerator.
1616
/// </summary>
1717
public ReadOnlySpan<char> Current { get; internal set; }
1818

1919
/// <summary>
20-
/// Constructs a <see cref="SpanSplitEnumerator{Char}"/> from a span and a delimiter. ONLY CONSUME THIS CLASS THROUGH <see cref="ReadOnlySpanExtensions.Split(ReadOnlySpan{char}, char, StringSplitOptions)"/>.
20+
/// Constructs a <see cref="SpanSplitStringSplitOptionsEnumerator"/> from a span and a delimiter. <strong>Only consume this class through <see cref="ReadOnlySpanExtensions.Split(ReadOnlySpan{char}, char, StringSplitOptions)"/></strong>.
2121
/// </summary>
22-
/// <param name="source">The <see cref="ReadOnlySpan{Char}"/> to be split.</param>
23-
/// <param name="delimiter">An <see cref="char"/> that delimits the various sub-ReadOnlySpans in the <see cref="ReadOnlySpan{Char}"/>.</param>
22+
/// <param name="source">The <see cref="ReadOnlySpan{Char}"/> to be split.</param>
23+
/// <param name="delimiter">A <see cref="char"/> that delimits the various sub-ReadOnlySpans in <paramref name="source"/>.</param>
2424
/// <param name="options">A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.</param>
2525
public SpanSplitStringSplitOptionsEnumerator(ReadOnlySpan<char> source, char delimiter, StringSplitOptions options)
2626
{
@@ -29,16 +29,17 @@ public SpanSplitStringSplitOptionsEnumerator(ReadOnlySpan<char> source, char del
2929
Options = options;
3030
Current = default;
3131
}
32-
/// <summary></summary>
32+
33+
/// <summary>Returns an enumerator that iterates through a collection.</summary>
3334
public readonly SpanSplitStringSplitOptionsEnumerator GetEnumerator()
3435
{
3536
return this;
3637
}
37-
38+
3839
/// <summary>
3940
/// Advances the enumerator to the next element of the collection.
4041
/// </summary>
41-
/// <returns><code>true</code> if the enumerator was successfully advanced to the next element; <code>false</code> if the enumerator has passed the end of the collection.</returns>
42+
/// <returns><see langword="true"/> if the enumerator was successfully advanced to the next element; <see langword="false"/> if the enumerator has passed the end of the collection.</returns>
4243
public bool MoveNext()
4344
{
4445
ReadOnlySpan<char> span = Span;

src/Enumerators/Split/SpanSplitStringSplitOptionsWithCountEnumerator.cs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
namespace SpanExtensions.Enumerators
44
{
5-
/// <summary>
6-
/// Supports iteration over a <see cref="ReadOnlySpan{Char}"/> by splitting it at a specified delimiter and based on specified <see cref="StringSplitOptions"/> with an upper limit of splits performed.
7-
/// </summary>
5+
/// <summary>
6+
/// Supports iteration over a <see cref="ReadOnlySpan{Char}"/> by splitting it at a specified delimiter and based on specified <see cref="StringSplitOptions"/> with an upper limit of splits performed.
7+
/// </summary>
88
public ref struct SpanSplitStringSplitOptionsWithCountEnumerator
99
{
1010
ReadOnlySpan<char> Span;
@@ -14,10 +14,17 @@ public ref struct SpanSplitStringSplitOptionsWithCountEnumerator
1414
int currentCount;
1515

1616
/// <summary>
17-
/// Gets the element in the collection at the current position of the enumerator.
17+
/// Gets the element in the collection at the current position of the enumerator.
1818
/// </summary>
1919
public ReadOnlySpan<char> Current { get; internal set; }
2020

21+
/// <summary>
22+
/// Constructs a <see cref="SpanSplitStringSplitOptionsWithCountEnumerator"/> from a span and a delimiter. <strong>Only consume this class through <see cref="ReadOnlySpanExtensions.Split(ReadOnlySpan{char}, char, StringSplitOptions)"/></strong>.
23+
/// </summary>
24+
/// <param name="source">The <see cref="ReadOnlySpan{Char}"/> to be split.</param>
25+
/// <param name="delimiter">A <see cref="char"/> that delimits the various sub-ReadOnlySpans in <paramref name="source"/>.</param>
26+
/// <param name="options">A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.</param>
27+
/// <param name="count">The maximum number of sub-ReadOnlySpans to split into.</param>
2128
public SpanSplitStringSplitOptionsWithCountEnumerator(ReadOnlySpan<char> source, char delimiter, StringSplitOptions options, int count)
2229
{
2330
Span = source;
@@ -27,7 +34,8 @@ public SpanSplitStringSplitOptionsWithCountEnumerator(ReadOnlySpan<char> source,
2734
Current = default;
2835
currentCount = 0;
2936
}
30-
/// <summary></summary>
37+
38+
/// <summary>Returns an enumerator that iterates through a collection.</summary>
3139
public readonly SpanSplitStringSplitOptionsWithCountEnumerator GetEnumerator()
3240
{
3341
return this;
@@ -36,7 +44,7 @@ public readonly SpanSplitStringSplitOptionsWithCountEnumerator GetEnumerator()
3644
/// <summary>
3745
/// Advances the enumerator to the next element of the collection.
3846
/// </summary>
39-
/// <returns><code>true</code> if the enumerator was successfully advanced to the next element; <code>false</code> if the enumerator has passed the end of the collection.</returns>
47+
/// <returns><see langword="true"/> if the enumerator was successfully advanced to the next element; <see langword="false"/> if the enumerator has passed the end of the collection.</returns>
4048
public bool MoveNext()
4149
{
4250
ReadOnlySpan<char> span = Span;

src/Enumerators/Split/SpanSplitWithCountEnumerator.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace SpanExtensions.Enumerators
55
/// <summary>
66
/// Supports iteration over a <see cref="ReadOnlySpan{T}"/> by splitting it a a specified delimiter of type <typeparamref name="T"/> with an upper limit of splits performed.
77
/// </summary>
8-
/// <typeparam name="T">The type of elements in the enumerated <see cref="ReadOnlySpan{T}"/></typeparam>
8+
/// <typeparam name="T">The type of elements in the enumerated <see cref="ReadOnlySpan{T}"/>.</typeparam>
99
public ref struct SpanSplitWithCountEnumerator<T> where T : IEquatable<T>
1010
{
1111
ReadOnlySpan<T> Span;
@@ -14,10 +14,16 @@ namespace SpanExtensions.Enumerators
1414
int currentCount;
1515

1616
/// <summary>
17-
/// Gets the element in the collection at the current position of the enumerator.
17+
/// Gets the element in the collection at the current position of the enumerator.
1818
/// </summary>
1919
public ReadOnlySpan<T> Current { get; internal set; }
2020

21+
/// <summary>
22+
/// Constructs a <see cref="SpanSplitWithCountEnumerator{T}"/> from a span and a delimiter. <strong>Only consume this class through <see cref="ReadOnlySpanExtensions.Split{T}(ReadOnlySpan{T}, T)"/></strong>.
23+
/// </summary>
24+
/// <param name="source">The <see cref="ReadOnlySpan{T}"/> to be split.</param>
25+
/// <param name="delimiter">An instance of <typeparamref name="T"/> that delimits the various sub-ReadOnlySpans in <paramref name="source"/>.</param>
26+
/// <param name="count">The maximum number of sub-ReadOnlySpans to split into.</param>
2127
public SpanSplitWithCountEnumerator(ReadOnlySpan<T> source, T delimiter, int count)
2228
{
2329
Span = source;
@@ -26,7 +32,8 @@ public SpanSplitWithCountEnumerator(ReadOnlySpan<T> source, T delimiter, int cou
2632
Current = default;
2733
currentCount = 0;
2834
}
29-
/// <summary></summary>
35+
36+
/// <summary>Returns an enumerator that iterates through a collection.</summary>
3037
public readonly SpanSplitWithCountEnumerator<T> GetEnumerator()
3138
{
3239
return this;
@@ -35,7 +42,7 @@ public readonly SpanSplitWithCountEnumerator<T> GetEnumerator()
3542
/// <summary>
3643
/// Advances the enumerator to the next element of the collection.
3744
/// </summary>
38-
/// <returns><code>true</code> if the enumerator was successfully advanced to the next element; <code>false</code> if the enumerator has passed the end of the collection.</returns>
45+
/// <returns><see langword="true"/> if the enumerator was successfully advanced to the next element; <see langword="false"/> if the enumerator has passed the end of the collection.</returns>
3946
public bool MoveNext()
4047
{
4148
ReadOnlySpan<T> span = Span;

src/Enumerators/SplitAny/SpanSplitAnyEnumerator.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,32 @@ namespace SpanExtensions.Enumerators
44
{
55

66
/// <summary>
7-
/// Supports iteration over a <see cref="ReadOnlySpan{T}"/> by splitting it at specified delimiters of type <typeparamref name="T"/>.
7+
/// Supports iteration over a <see cref="ReadOnlySpan{T}"/> by splitting it at specified delimiters of type <typeparamref name="T"/>.
88
/// </summary>
9-
/// <typeparam name="T">The type of elements in the enumerated <see cref="ReadOnlySpan{T}"/></typeparam>
9+
/// <typeparam name="T">The type of elements in the enumerated <see cref="ReadOnlySpan{T}"/>.</typeparam>
1010
public ref struct SpanSplitAnyEnumerator<T> where T : IEquatable<T>
1111
{
1212
ReadOnlySpan<T> Span;
1313
readonly ReadOnlySpan<T> Delimiters;
1414

1515
/// <summary>
16-
/// Gets the element in the collection at the current position of the enumerator.
16+
/// Gets the element in the collection at the current position of the enumerator.
1717
/// </summary>
1818
public ReadOnlySpan<T> Current { get; internal set; }
1919

20+
/// <summary>
21+
/// Constructs a <see cref="SpanSplitAnyEnumerator{T}"/> from a span and a delimiter. <strong>Only consume this class through <see cref="ReadOnlySpanExtensions.SplitAny{T}(ReadOnlySpan{T}, ReadOnlySpan{T})"/></strong>.
22+
/// </summary>
23+
/// <param name="source">The <see cref="ReadOnlySpan{T}"/> to be split.</param>
24+
/// <param name="delimiters">A <see cref="ReadOnlySpan{T}"/> with the instances of <typeparamref name="T"/> that delimit the various sub-ReadOnlySpans in <paramref name="source"/>.</param>
2025
public SpanSplitAnyEnumerator(ReadOnlySpan<T> source, ReadOnlySpan<T> delimiters)
2126
{
2227
Span = source;
2328
Delimiters = delimiters;
2429
Current = default;
2530
}
26-
/// <summary></summary>
31+
32+
/// <summary>Returns an enumerator that iterates through a collection.</summary>
2733
public readonly SpanSplitAnyEnumerator<T> GetEnumerator()
2834
{
2935
return this;
@@ -32,7 +38,7 @@ public readonly SpanSplitAnyEnumerator<T> GetEnumerator()
3238
/// <summary>
3339
/// Advances the enumerator to the next element of the collection.
3440
/// </summary>
35-
/// <returns><code>true</code> if the enumerator was successfully advanced to the next element; <code>false</code> if the enumerator has passed the end of the collection.</returns>
41+
/// <returns><see langword="true"/> if the enumerator was successfully advanced to the next element; <see langword="false"/> if the enumerator has passed the end of the collection.</returns>
3642
public bool MoveNext()
3743
{
3844
ReadOnlySpan<T> span = Span;

src/Enumerators/SplitAny/SpanSplitAnyStringSplitOptionsEnumerator.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,35 @@
22

33
namespace SpanExtensions.Enumerators
44
{
5-
/// <summary>
6-
/// Supports iteration over a <see cref="ReadOnlySpan{Char}"/> by splitting it at specified delimiters and based on specified <see cref="StringSplitOptions"/>.
7-
/// </summary>
5+
/// <summary>
6+
/// Supports iteration over a <see cref="ReadOnlySpan{Char}"/> by splitting it at specified delimiters and based on specified <see cref="StringSplitOptions"/>.
7+
/// </summary>
88
public ref struct SpanSplitAnyStringSplitOptionsEnumerator
99
{
1010
ReadOnlySpan<char> Span;
1111
readonly ReadOnlySpan<char> Delimiters;
1212
readonly StringSplitOptions Options;
1313

1414
/// <summary>
15-
/// Gets the element in the collection at the current position of the enumerator.
15+
/// Gets the element in the collection at the current position of the enumerator.
1616
/// </summary>
1717
public ReadOnlySpan<char> Current { get; internal set; }
1818

19+
/// <summary>
20+
/// Constructs a <see cref="SpanSplitAnyStringSplitOptionsEnumerator"/> from a span and a delimiter. <strong>Only consume this class through <see cref="ReadOnlySpanExtensions.SplitAny(ReadOnlySpan{char}, ReadOnlySpan{char}, StringSplitOptions)"/></strong>.
21+
/// </summary>
22+
/// <param name="source">The <see cref="ReadOnlySpan{Char}"/> to be split.</param>
23+
/// <param name="delimiters">A <see cref="ReadOnlySpan{Char}"/> with the <see cref="char"/> elements that delimit the various sub-ReadOnlySpans in <paramref name="source"/>.</param>
24+
/// <param name="options">A bitwise combination of the enumeration values that specifies whether to trim results and include empty results.</param>
1925
public SpanSplitAnyStringSplitOptionsEnumerator(ReadOnlySpan<char> source, ReadOnlySpan<char> delimiters, StringSplitOptions options)
2026
{
2127
Span = source;
2228
Delimiters = delimiters;
2329
Options = options;
2430
Current = default;
2531
}
26-
/// <summary></summary>
32+
33+
/// <summary>Returns an enumerator that iterates through a collection.</summary>
2734
public readonly SpanSplitAnyStringSplitOptionsEnumerator GetEnumerator()
2835
{
2936
return this;
@@ -32,7 +39,7 @@ public readonly SpanSplitAnyStringSplitOptionsEnumerator GetEnumerator()
3239
/// <summary>
3340
/// Advances the enumerator to the next element of the collection.
3441
/// </summary>
35-
/// <returns><code>true</code> if the enumerator was successfully advanced to the next element; <code>false</code> if the enumerator has passed the end of the collection.</returns>
42+
/// <returns><see langword="true"/> if the enumerator was successfully advanced to the next element; <see langword="false"/> if the enumerator has passed the end of the collection.</returns>
3643
public bool MoveNext()
3744
{
3845
ReadOnlySpan<char> span = Span;

0 commit comments

Comments
 (0)