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()
2727 throw new ArgumentException ( "The target span is too short to copy all the current items to" ) ;
2828 }
2929
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+
3038 /// <summary>
3139 /// Throws an <see cref="ArrayTypeMismatchException"/> when using an array of an invalid type.
3240 /// </summary>
Original file line number Diff line number Diff line change @@ -654,14 +654,14 @@ public void CopyTo(Span<T> destination)
654654 /// </summary>
655655 /// <param name="destination">The destination <see cref="Span2D{T}"/> instance.</param>
656656 /// <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.
658658 /// </exception>
659659 public void CopyTo ( Span2D < T > destination )
660660 {
661661 if ( destination . Height != Height ||
662662 destination . Width != Width )
663663 {
664- ThrowHelper . ThrowArgumentException ( ) ;
664+ ThrowHelper . ThrowArgumentExceptionForDestinationWithNotSameShape ( ) ;
665665 }
666666
667667 if ( IsEmpty )
Original file line number Diff line number Diff line change @@ -767,14 +767,14 @@ public void CopyTo(Span<T> destination)
767767 /// </summary>
768768 /// <param name="destination">The destination <see cref="Span2D{T}"/> instance.</param>
769769 /// <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.
771771 /// </exception>
772772 public void CopyTo ( Span2D < T > destination )
773773 {
774774 if ( destination . Height != Height ||
775775 destination . width != this . width )
776776 {
777- ThrowHelper . ThrowArgumentException ( ) ;
777+ ThrowHelper . ThrowArgumentExceptionForDestinationWithNotSameShape ( ) ;
778778 }
779779
780780 if ( IsEmpty )
You can’t perform that action at this time.
0 commit comments