public ArraySegment(T[] array, int offset, int count) { // Validate arguments, check is minimal instructions with reduced branching for inlinable fast-path // Negative values discovered though conversion to high values when converted to unsigned // Failure should be rare and location determination and message is delegated to failure functions if (array == null || (uint)offset > (uint)array.Length || (uint)count > (uint)(array.Length - offset)) { ThrowHelper.ThrowArraySegmentCtorValidationFailedExceptions(array, offset, count); } _array = array; _offset = offset; _count = count; }
public ArraySegment(T[] array, int offset, int count) { // Validate arguments, check is minimal instructions with reduced branching for inlinable fast-path // Failure should be rare and location determination and message is delegated to failure functions if (array == null || (offset | count) < 0 || (array.Length - offset < count)) { ThrowHelper.ThrowArraySegmentCtorValidationFailedExceptions(array, offset, count); } Contract.EndContractBlock(); _array = array; _offset = offset; _count = count; }