/// <summary> /// Copies the items of this <see cref="ArraySection{T}"/> to a compatible instance, starting at a particular index. /// </summary> /// <param name="target">The <see cref="ArraySection{T}"/> that is the destination of the elements copied from this instance.</param> /// <param name="targetIndex">The zero-based index in <paramref name="target"/> at which copying begins.</param> public void CopyTo(ArraySection <T> target, int targetIndex = 0) { if (target.IsNull) { Throw.ArgumentNullException(Argument.target); } if (targetIndex < 0 || targetIndex > target.Length) { Throw.ArgumentOutOfRangeException(Argument.targetIndex); } if (target.length - targetIndex < length) { Throw.ArgumentException(Argument.target, Res.ICollectionCopyToDestArrayShort); } array?.CopyElements(offset, target.array, target.offset + targetIndex, length); }
internal ArraySectionDebugView(ArraySection <T> array) => this.array = array;
/// <summary> /// Indicates whether the current <see cref="ArraySection{T}"/> instance is equal to another one specified in the <paramref name="other"/> parameter. /// </summary> /// <param name="other">An <see cref="ArraySection{T}"/> instance to compare with this instance.</param> /// <returns><see langword="true"/> if the current object is equal to the <paramref name="other"/> parameter; otherwise, <see langword="false"/>.</returns> public bool Equals(ArraySection <T> other) => array == other.array && offset == other.offset && length == other.length;