File tree Expand file tree Collapse file tree 3 files changed +12
-4
lines changed
Microsoft.Toolkit.HighPerformance/Memory Expand file tree Collapse file tree 3 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,14 @@ public static void ThrowArgumentExceptionForDestinationTooShort()
27
27
throw new ArgumentException ( "The target span is too short to copy all the current items to" ) ;
28
28
}
29
29
30
+ /// <summary>
31
+ /// Throws an <see cref="ArgumentException"/> when the target span does not have the same shape as the source.
32
+ /// </summary>
33
+ public static void ThrowArgumentExceptionForDestinationWithNotSameShape ( )
34
+ {
35
+ throw new ArgumentException ( "The target span does not have the same shape as the source one" ) ;
36
+ }
37
+
30
38
/// <summary>
31
39
/// Throws an <see cref="ArrayTypeMismatchException"/> when using an array of an invalid type.
32
40
/// </summary>
Original file line number Diff line number Diff line change @@ -654,14 +654,14 @@ public void CopyTo(Span<T> destination)
654
654
/// </summary>
655
655
/// <param name="destination">The destination <see cref="Span2D{T}"/> instance.</param>
656
656
/// <exception cref="ArgumentException">
657
- /// Thrown when <paramref name="destination" /> is shorter than the source <see cref="ReadOnlySpan2D{T}"/> instance.
657
+ /// Thrown when <paramref name="destination" /> does not have the same shape as the source <see cref="ReadOnlySpan2D{T}"/> instance.
658
658
/// </exception>
659
659
public void CopyTo ( Span2D < T > destination )
660
660
{
661
661
if ( destination . Height != Height ||
662
662
destination . Width != Width )
663
663
{
664
- ThrowHelper . ThrowArgumentException ( ) ;
664
+ ThrowHelper . ThrowArgumentExceptionForDestinationWithNotSameShape ( ) ;
665
665
}
666
666
667
667
if ( IsEmpty )
Original file line number Diff line number Diff line change @@ -767,14 +767,14 @@ public void CopyTo(Span<T> destination)
767
767
/// </summary>
768
768
/// <param name="destination">The destination <see cref="Span2D{T}"/> instance.</param>
769
769
/// <exception cref="ArgumentException">
770
- /// Thrown when <paramref name="destination" /> is shorter than the source <see cref="Span2D{T}"/> instance.
770
+ /// Thrown when <paramref name="destination" /> does not have the same shape as the source <see cref="Span2D{T}"/> instance.
771
771
/// </exception>
772
772
public void CopyTo ( Span2D < T > destination )
773
773
{
774
774
if ( destination . Height != Height ||
775
775
destination . width != this . width )
776
776
{
777
- ThrowHelper . ThrowArgumentException ( ) ;
777
+ ThrowHelper . ThrowArgumentExceptionForDestinationWithNotSameShape ( ) ;
778
778
}
779
779
780
780
if ( IsEmpty )
You can’t perform that action at this time.
0 commit comments