Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Range{T}"/> class.
        /// </summary>
        /// <param name="lowerBound">The start of the range.</param>
        /// <param name="upperBound">The end of the range.</param>
        /// <param name="comparer">The <see cref="IComparer{T}"/> used to perform range comparisons.</param>
        /// <param name="option"></param>
        public Range(T lowerBound, T upperBound, IComparer <T> comparer, RangeEndpointOption option)
        {
            Requires.NotNull(comparer, nameof(comparer));
            Requires.IsTrue(comparer.Compare(lowerBound, upperBound) <= 0, Properties.Resources.ArgumentOutOfRange_UpperBound);

            this.LowerBound = lowerBound;
            this.UpperBound = upperBound;
            this.Comparer   = comparer;
            this.option     = option;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Range{T}"/> class.
        /// </summary>
        /// <param name="lowerBound">The start of the range.</param>
        /// <param name="upperBound">The end of the range.</param>
        /// <param name="comparer">
        /// The <see cref="IComparer{T}"/> used to perform range comparisons.
        /// </param>
        /// <param name="option"></param>
        public Range(T lowerBound, T upperBound, IComparer <T> comparer, RangeEndpointOption option)
        {
            Requires.NotNull(comparer, nameof(comparer));
            Requires.That(comparer.Compare(lowerBound, upperBound) <= 0, nameof(lowerBound), Strings.ArgumentOutOfRange_UpperBound);

            this.LowerBound = lowerBound;
            this.UpperBound = upperBound;
            this.Comparer   = comparer;
            this.option     = option;
        }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Range{T}"/> class.
 /// </summary>
 /// <param name="lowerBound">The start of the range.</param>
 /// <param name="upperBound">The end of the range.</param>
 /// <param name="option"></param>
 public Range(T lowerBound, T upperBound, RangeEndpointOption option)
     : this(lowerBound, upperBound, Comparer <T> .Default, option)
 {
 }