Exemplo n.º 1
0
        /// <summary>
        ///     Initializes a new instance of <see cref="UInt24"/> to the value of the specified <see cref="Int24"/>.
        /// </summary>
        /// <exception cref="ArgumentOutOfRangeException">
        ///     Thrown when <paramref name="value"/> is a number less than <see cref="UInt24.MinValue"/> or greater than <see cref="UInt24.MaxValue"/>.
        /// </exception>
        /// <param name="value">
        ///      The value to represent as a <see cref="UInt24"/>.
        /// </param>
        public UInt24(Int24 value)
        {
            var uValue = (uint)value._value;

            if (uValue > MaxValue)
            {
                throw new ArgumentOutOfRangeException($"The value must be between {MinValue} and {MaxValue}");
            }

            _value = uValue;
        }
Exemplo n.º 2
0
 public UInt24(Int24 value) : this((uint)value._value)
 {
 }
Exemplo n.º 3
0
 public UInt24(Int24 value) : this(unchecked ((uint)value._value))
 {
 }