public static IPAddress ParseSubnetMask(String ipAddress)
        {
            var subnetMask       = ipAddress.Split('/').Last();
            var subnetMaskNumber = 0;

            if (!Int32.TryParse(subnetMask, out subnetMaskNumber))
            {
                return(IPAddress.Parse(subnetMask));
            }
            else
            {
                return(SubnetMask.CreateByNetBitLength(subnetMaskNumber));
            }
        }
 public static Boolean IsInSameSubnet(this IPAddress address2, IPAddress address, Int32 hostPartLength)
 {
     return(IsInSameSubnet(address2, address, SubnetMask.CreateByHostBitLength(hostPartLength)));
 }
Exemplo n.º 3
0
 public IPTenantIdentifierStrategy Add(IPAddress ipAddress, Int32 netmaskBits, String name)
 {
     return(this.Add(ipAddress, SubnetMask.CreateByNetBitLength(netmaskBits), name));
 }