예제 #1
0
        /// <summary>
        /// Checks whether the <see cref="IpRange"/> contains another specified <see cref="IpRange"/>.
        /// </summary>
        /// <param name="subRange">The IP range to be checked.</param>
        /// <returns>True if contains; otherwise false.</returns>
        public bool Contains(IpRange subRange)
        {
            if (subRange == null)
            {
                throw new ArgumentNullException(nameof(subRange));
            }

            if (subRange.Begin.AddressFamily != Begin.AddressFamily)
            {
                return(false);
            }

            return(subRange._low >= _low && subRange._high <= _high);
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="IpSet"/> class.
 /// </summary>
 /// <param name="range">The IP range.</param>
 public IpSet(IpRange range)
     : this(new[] { range })
 {
 }