System.Net.Topology.IPAddressExtensions.GetNetworkPrefix C# (CSharp) Method

GetNetworkPrefix() public static method

Gets the network prefix of an T:System.Net.IPAddress.
public static GetNetworkPrefix ( this address, NetMask mask ) : IPAddress
address this The address
mask NetMask The net mask of the network
return IPAddress
        public static IPAddress GetNetworkPrefix(this IPAddress address, NetMask mask)
        {
            if (address == null)
                throw new ArgumentNullException(nameof(address));
            if (mask == null)
                throw new ArgumentNullException(nameof(mask));

            if (address.AddressFamily != Sockets.AddressFamily.InterNetwork)
                throw new NotSupportedException(OnlyIPv4Supported);

            return mask & address;
        }