Plarium.Geo/System/Net/IPNetwork.cs
/// <summary>
/// return true if ipaddress is contained in network
/// </summary>
/// <param name="network"></param>
/// <param name="ipaddress"></param>
/// <returns></returns>
return true if ipaddress is contained in network
return true if ipaddress is contained in network
public static bool Contains(IPNetwork network, IPAddress ipaddress)
        {
            if (network == null)
            {
                throw new ArgumentNullException("network");
            }
            if (ipaddress == null)
            {
                throw new ArgumentNullException("ipaddress");
            }
            BigInteger uintNetwork = network._network;
            BigInteger uintBroadcast = network._broadcast;
            BigInteger uintAddress = IPNetwork.ToBigInteger(ipaddress);
            bool contains = (uintAddress >= uintNetwork && uintAddress <= uintBroadcast);
            return contains;
        }
public static bool Contains ( IPNetwork network , IPAddress ipaddress ) { if ( network == null ) { throw new ArgumentNullException ( " " ) ; } if ( ipaddress == null ) { throw new ArgumentNullException ( " " ) ; } BigInteger uintNetwork = network . _network ; BigInteger uintBroadcast = network . _broadcast ; BigInteger uintAddress = IPNetwork . ToBigInteger ( ipaddress ) ; bool contains = ( uintAddress >= uintNetwork && uintAddress <= uintBroadcast ) ; return contains ; }
return true if ipaddress is contained in network
return true if ipaddress is contained in network
None
network
IPNetwork
None
ipaddress
IPAddress
None