public StringSegment(string source, int offset, int count) { this.source = source ?? _empty; // 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 ((uint)offset > (uint)this.source.Length || (uint)count > (uint)(this.source.Length - offset)) { throw ThrowHelper.GetSegmentCtorValidationFailedException(this.source, offset, count); } this.HasSource = true; this.Offset = offset; this.Count = count; }