Skip to content

Commit 03dc23b

Browse files
authored
Merge pull request #17 from rameel/cleanup
- Remove unnecessary aggressive inlining - Polish xml-comments
2 parents 8fe4c19 + 3508ab9 commit 03dc23b

7 files changed

Lines changed: 55 additions & 44 deletions

File tree

Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
88
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
99
<PackageVersion Include="MinVer" Version="6.0.0" />
10-
<PackageVersion Include="NUnit" Version="4.3.2" />
11-
<PackageVersion Include="NUnit3TestAdapter" Version="5.0.0" />
10+
<PackageVersion Include="NUnit" Version="4.4.0" />
11+
<PackageVersion Include="NUnit3TestAdapter" Version="5.1.0" />
1212
</ItemGroup>
1313
</Project>

Ramstack.Structures/Collections/ArrayViewExtensions.cs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,38 @@ public static class ArrayViewExtensions
88
/// <summary>
99
/// Creates a new <see cref="ArrayView{T}"/> over an array.
1010
/// </summary>
11+
/// <typeparam name="T">The type of elements in the array.</typeparam>
1112
/// <param name="value">The target array.</param>
1213
/// <returns>
13-
/// An <see cref="ArrayView{T}"/> representing the array.
14+
/// An <see cref="ArrayView{T}"/> representing the specified array.
1415
/// </returns>
15-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
1616
public static ArrayView<T> AsView<T>(this T[]? value) =>
1717
new(value ?? []);
1818

1919
/// <summary>
20-
/// Creates a new <see cref="ArrayView{T}"/> over a portion of the target array from a specified position to the end of the array.
20+
/// Creates a new <see cref="ArrayView{T}"/> over a portion of the specified array,
21+
/// starting at a specified position to the end of the array.
2122
/// </summary>
22-
/// <param name="value">The target array.</param>
23-
/// <param name="index">The index at which to begin the array view.</param>
23+
/// <typeparam name="T">The type of elements in the array.</typeparam>
24+
/// <param name="value">The array to create a view over.</param>
25+
/// <param name="index">The zero-based starting position of the view in the array.</param>
2426
/// <returns>
25-
/// An <see cref="ArrayView{T}"/> representing the array.
27+
/// An <see cref="ArrayView{T}"/> representing the specified portion of the array.
2628
/// </returns>
27-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
2829
public static ArrayView<T> AsView<T>(this T[]? value, int index) =>
2930
new(value ?? [], index);
3031

3132
/// <summary>
32-
/// Creates a new <see cref="ArrayView{T}"/> over a portion of the target array from a specified position for a specified number of elements.
33+
/// Creates a new <see cref="ArrayView{T}"/> over a portion of the specified array
34+
/// starting at a specified position for a specified number of elements.
3335
/// </summary>
34-
/// <param name="value">The target array.</param>
35-
/// <param name="index">The index at which to begin the array view.</param>
36-
/// <param name="count">The number of items in the array view.</param>
36+
/// <typeparam name="T">The type of elements in the array.</typeparam>
37+
/// <param name="value">The array to create a view over. Can be null.</param>
38+
/// <param name="index">The zero-based starting position of the view in the array.</param>
39+
/// <param name="count">The number of elements to include in the view.</param>
3740
/// <returns>
38-
/// An <see cref="ArrayView{T}"/> representing the array.
41+
/// An <see cref="ArrayView{T}"/> representing the specified portion of the array.
3942
/// </returns>
40-
[MethodImpl(MethodImplOptions.AggressiveInlining)]
4143
public static ArrayView<T> AsView<T>(this T[]? value, int index, int count) =>
4244
new(value ?? [], index, count);
4345

Ramstack.Structures/Collections/ArrayView`1.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public ArrayView(T[] array)
5959
/// a view for the specified range of the elements in the specified array.
6060
/// </summary>
6161
/// <param name="array">The array to wrap.</param>
62-
/// <param name="index">The zero-based index of the first element in the range.</param>
62+
/// <param name="index">The zero-based starting position of the view in the array.</param>
6363
[MethodImpl(MethodImplOptions.AggressiveInlining)]
6464
public ArrayView(T[] array, int index)
6565
{
@@ -76,8 +76,8 @@ public ArrayView(T[] array, int index)
7676
/// a view for the specified range of the elements in the specified array.
7777
/// </summary>
7878
/// <param name="array">The array to wrap.</param>
79-
/// <param name="index">The zero-based index of the first element in the range.</param>
80-
/// <param name="length">The number of elements in the range.</param>
79+
/// <param name="index">The zero-based starting position of the view in the array.</param>
80+
/// <param name="length">The number of characters to include in the view.</param>
8181
[MethodImpl(MethodImplOptions.AggressiveInlining)]
8282
public ArrayView(T[] array, int index, int length)
8383
{
@@ -108,9 +108,9 @@ public ArrayView(T[] array, int index, int length)
108108
/// <paramref name="length"/> are within bounds).
109109
/// </remarks>
110110
/// <param name="array">The array to wrap.</param>
111-
/// <param name="index">The zero-based index of the first element in the range.</param>
112-
/// <param name="length">The number of elements in the range.</param>
113-
/// <param name="unused">Unused parameter, exists solely to disambiguate overloads.</param>
111+
/// <param name="index">The zero-based starting position of the view in the array.</param>
112+
/// <param name="length">The number of characters to include in the view.</param>
113+
/// <param name="unused">Unused parameter used only to differentiate between overloads.</param>
114114
[MethodImpl(MethodImplOptions.AggressiveInlining)]
115115
internal ArrayView(T[] array, int index, int length, int unused)
116116
{

Ramstack.Structures/Internal/ThrowHelper.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
namespace Ramstack.Internal;
22

3+
/// <summary>
4+
/// Provides helper methods for throwing exceptions.
5+
/// </summary>
36
internal static class ThrowHelper
47
{
8+
/// <summary>
9+
/// Throws an <see cref="ArgumentOutOfRangeException"/>.
10+
/// </summary>
511
[DoesNotReturn]
612
public static void ThrowArgumentOutOfRangeException() =>
713
throw new ArgumentOutOfRangeException();
814

15+
/// <summary>
16+
/// Throws a <see cref="NotSupportedException"/>.
17+
/// </summary>
918
[DoesNotReturn]
1019
public static void ThrowNotSupportedException() =>
1120
throw new NotSupportedException();

Ramstack.Structures/Text/StringView.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public StringView(string value) : this(value, 0, value.Length, unused: 0)
5454
/// a view for the specified range of the characters in the specified string.
5555
/// </summary>
5656
/// <param name="value">The string to wrap.</param>
57-
/// <param name="index">The zero-based index of the first character in the range.</param>
57+
/// <param name="index">The zero-based starting position of the view in the string.</param>
5858
[MethodImpl(MethodImplOptions.AggressiveInlining)]
5959
public StringView(string value, int index)
6060
{
@@ -71,8 +71,8 @@ public StringView(string value, int index)
7171
/// a view for the specified range of the characters in the specified string.
7272
/// </summary>
7373
/// <param name="value">The string to wrap.</param>
74-
/// <param name="index">The zero-based index of the first character in the range.</param>
75-
/// <param name="length">The number of characters in the range.</param>
74+
/// <param name="index">The zero-based starting position of the view in the string.</param>
75+
/// <param name="length">The number of characters to include in the view.</param>
7676
[MethodImpl(MethodImplOptions.AggressiveInlining)]
7777
public StringView(string value, int index, int length)
7878
{
@@ -103,9 +103,9 @@ public StringView(string value, int index, int length)
103103
/// <paramref name="length"/> are within bounds).
104104
/// </remarks>
105105
/// <param name="value">The string to wrap.</param>
106-
/// <param name="index">The zero-based index of the first character in the range.</param>
107-
/// <param name="length">The number of characters in the range.</param>
108-
/// <param name="unused">Unused parameter, exists solely to disambiguate overloads.</param>
106+
/// <param name="index">The zero-based starting position of the view in the string.</param>
107+
/// <param name="length">The number of characters to include in the view.</param>
108+
/// <param name="unused">Unused parameter used only to differentiate between overloads.</param>
109109
[MethodImpl(MethodImplOptions.AggressiveInlining)]
110110
private StringView(string value, int index, int length, int unused)
111111
{

Ramstack.Structures/Text/StringViewComparer.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,14 +126,14 @@ private sealed class CultureAwareComparer(CompareInfo info, CompareOptions optio
126126
#endif
127127
{
128128
/// <summary>
129-
/// A singleton instance of the <see cref="T:CultureAwareComparer"/> class
129+
/// A singleton instance of the <see cref="StringViewComparer.CultureAwareComparer"/> class
130130
/// for invariant case-sensitive comparison.
131131
/// </summary>
132132
public static readonly CultureAwareComparer InvariantInstance =
133133
new(CultureInfo.InvariantCulture.CompareInfo, CompareOptions.None);
134134

135135
/// <summary>
136-
/// A singleton instance of the <see cref="T:CultureAwareComparer"/> class
136+
/// A singleton instance of the <see cref="StringViewComparer.CultureAwareComparer"/> class
137137
/// for invariant case-insensitive comparison.
138138
/// </summary>
139139
public static readonly CultureAwareComparer InvariantIgnoreCaseInstance =
@@ -180,7 +180,7 @@ private sealed class OrdinalComparer : StringViewComparer
180180
#endif
181181
{
182182
/// <summary>
183-
/// A singleton instance of the <see cref="T:OrdinalComparer"/> class.
183+
/// A singleton instance of the <see cref="StringViewComparer.OrdinalComparer"/> class.
184184
/// </summary>
185185
public static readonly OrdinalComparer Instance = new();
186186

@@ -225,7 +225,7 @@ private sealed class OrdinalIgnoreCaseComparer : StringViewComparer
225225
#endif
226226
{
227227
/// <summary>
228-
/// A singleton instance of the <see cref="T:OrdinalIgnoreCaseComparer"/> class.
228+
/// A singleton instance of the <see cref="StringViewComparer.OrdinalIgnoreCaseComparer"/> class.
229229
/// </summary>
230230
public static readonly OrdinalIgnoreCaseComparer Instance = new();
231231

Ramstack.Structures/Text/StringViewExtensions.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,34 +8,34 @@ public static class StringViewExtensions
88
/// <summary>
99
/// Creates a new <see cref="StringView"/> over a string.
1010
/// </summary>
11-
/// <param name="value">The target string.</param>
11+
/// <param name="value">The string to create a view over.</param>
1212
/// <returns>
13-
/// The read-only view representation of the string.
13+
/// A <see cref="StringView"/> representing the specified string.
1414
/// </returns>
1515
public static StringView AsView(this string? value) =>
1616
new(value ?? "");
1717

1818
/// <summary>
19-
/// Creates a new <see cref="StringView"/> over a portion of the target string
20-
/// from a specified position to the end of the string.
19+
/// Creates a new <see cref="StringView"/> over a portion of the specified string
20+
/// starting at a specified position to the end of the string.
2121
/// </summary>
22-
/// <param name="value">The target string.</param>
23-
/// <param name="index">The index at which to begin this slice.</param>
22+
/// <param name="value">The string to create a view over.</param>
23+
/// <param name="index">The zero-based starting position of the view in the string.</param>
2424
/// <returns>
25-
/// The read-only view representation of the string.
25+
/// A <see cref="StringView"/> representing the specified portion of the string.
2626
/// </returns>
2727
public static StringView AsView(this string? value, int index) =>
2828
new(value ?? "", index);
2929

3030
/// <summary>
31-
/// Creates a new <see cref="StringView"/> over a portion of the target string
32-
/// from a specified position for a specified number of characters.
31+
/// Creates a new <see cref="StringView"/> over a portion of the specified string
32+
/// starting at a specified position for a specified number of characters.
3333
/// </summary>
34-
/// <param name="value">The target string.</param>
35-
/// <param name="index">The index at which to begin this slice.</param>
36-
/// <param name="length">The desired length for the slice.</param>
34+
/// <param name="value">The string to create a view over.</param>
35+
/// <param name="index">The zero-based starting position of the view in the string.</param>
36+
/// <param name="length">The number of characters to include in the view.</param>
3737
/// <returns>
38-
/// The read-only view representation of the string.
38+
/// A <see cref="StringView"/> representing the specified portion of the string.
3939
/// </returns>
4040
public static StringView AsView(this string? value, int index, int length) =>
4141
new(value ?? "", index, length);

0 commit comments

Comments
 (0)