|
2 | 2 | using System.Runtime.CompilerServices; |
3 | 3 | using System.Text; |
4 | 4 | using BenchmarkDotNet.Attributes; |
| 5 | +using Light.GuardClauses.ExceptionFactory; |
5 | 6 | using Light.GuardClauses.Exceptions; |
6 | 7 |
|
7 | 8 | namespace Light.GuardClauses.Performance.CollectionAssertions |
@@ -47,23 +48,23 @@ public static class SpanMustHaveLengthExtensions |
47 | 48 | public static Span<T> MustHaveLengthCopyByValue<T>(this Span<T> parameter, int length, string parameterName = null, string message = null) |
48 | 49 | { |
49 | 50 | if (parameter.Length != length) |
50 | | - Throw.InvalidSpanLength(parameter, length, parameterName, message); |
| 51 | + Throw.InvalidSpanLength((ReadOnlySpan<T>) parameter, length, parameterName, message); |
51 | 52 | return parameter; |
52 | 53 | } |
53 | 54 |
|
54 | 55 | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
55 | 56 | public static Span<T> MustHaveLengthInParameter<T>(in this Span<T> parameter, int length, string parameterName = null, string message = null) |
56 | 57 | { |
57 | 58 | if (parameter.Length != length) |
58 | | - Throw.InvalidSpanLength(parameter, length, parameterName, message); |
| 59 | + Throw.InvalidSpanLength((ReadOnlySpan<T>) parameter, length, parameterName, message); |
59 | 60 | return parameter; |
60 | 61 | } |
61 | 62 |
|
62 | 63 | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
63 | 64 | public static ref Span<T> MustHaveLengthInOut<T>(ref this Span<T> parameter, int length, string parameterName = null, string message = null) |
64 | 65 | { |
65 | 66 | if (parameter.Length != length) |
66 | | - Throw.InvalidSpanLength(parameter, length, parameterName, message); |
| 67 | + Throw.InvalidSpanLength((ReadOnlySpan<T>) parameter, length, parameterName, message); |
67 | 68 | return ref parameter; |
68 | 69 | } |
69 | 70 | } |
|
0 commit comments