/// <summary>
        /// Returns an enumerator that iterates through the collection.
        /// </summary>
        /// <returns>An enumerator that can be used to iterate through the collection.</returns>
        public IEnumerator <IPAddress> GetEnumerator()
        {
            var first = this.Begin.GetAddressBytes();
            var last  = this.End.GetAddressBytes();

            for (var ip = first; Bitwise.GreaterEqual(ip, last); ip = Bitwise.Increment(ip))
            {
                yield return(new IPAddress(ip));
            }
        }
        /// <summary>
        /// Determines whether the current IPAddressRange contains the specified ip address range.
        /// </summary>
        /// <param name="ipAddressRange">The ip address range.</param>
        /// <returns>true if the current IPAddressRange contains the specified ip address range; otherwise, false.</returns>
        public bool Contains(IPAddressRange ipAddressRange)
        {
            if (ipAddressRange == null)
            {
                throw new ArgumentNullException("ipAddressRange");
            }

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

            return
                (Bitwise.GreaterEqual(this.Begin.GetAddressBytes(), ipAddressRange.Begin.GetAddressBytes()) &&
                 Bitwise.LessEqual(this.End.GetAddressBytes(), ipAddressRange.End.GetAddressBytes()));
        }
        /// <summary>
        /// Determines whether the current IPAddressRange contains the specified ip address.
        /// </summary>
        /// <param name="ipAddress">The ip address.</param>
        /// <returns>true if the current IPAddressRange contains the specified ip address; otherwise, false.</returns>
        public bool Contains(IPAddress ipAddress)
        {
            if (ipAddress == null)
            {
                throw new ArgumentNullException("ipAddress");
            }

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

            var adrBytes = ipAddress.GetAddressBytes();

            return
                (Bitwise.GreaterEqual(this.Begin.GetAddressBytes(), adrBytes) &&
                 Bitwise.LessEqual(this.End.GetAddressBytes(), adrBytes));
        }
        /// <summary>
        /// Determines whether the current IPAddressRange contains the specified ip address.
        /// </summary>
        /// <param name="ipAddressString">The ip address.</param>
        /// <returns>true if the current IPAddressRange contains the specified ip address; otherwise, false.</returns>
        public bool Contains(string ipAddressString)
        {
            if (string.IsNullOrEmpty(ipAddressString))
            {
                throw new ArgumentNullException("ipAddressString");
            }

            var ipAddress = IPAddress.Parse(ipAddressString);

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

            var adrBytes = ipAddress.GetAddressBytes();

            return
                (Bitwise.GreaterEqual(this.Begin.GetAddressBytes(), adrBytes) &&
                 Bitwise.LessEqual(this.End.GetAddressBytes(), adrBytes));
        }