/// <summary> /// Copies the contents of this read-only span into destination span. If the source /// and destinations overlap, this method behaves as if the original values in /// a temporary location before the destination is overwritten. /// /// <param name="destination">The span to copy items into.</param> /// <exception cref="System.ArgumentException"> /// Thrown when the destination Span is shorter than the source Span. /// </exception> /// </summary> public void CopyTo(Span <T> destination) { if (!TryCopyTo(destination)) { ThrowHelper.ThrowArgumentException_DestinationTooShort(); } }
internal void CopyTo(Span <char> destination) { if ((uint)Length <= (uint)destination.Length) { Buffer.Memmove(ref destination._pointer.Value, ref _firstChar, (uint)Length); } else { ThrowHelper.ThrowArgumentException_DestinationTooShort(); } }
public void CopyTo(ArraySegment <T> destination) { ThrowInvalidOperationIfDefault(); destination.ThrowInvalidOperationIfDefault(); if (_count > destination._count) { ThrowHelper.ThrowArgumentException_DestinationTooShort(); } System.Array.Copy(_array, _offset, destination._array, destination._offset, _count); }