System.Net.IPAddress.IPAddress C# (CSharp) Method

IPAddress() public method

public IPAddress ( byte address, long scopeid ) : System.Diagnostics
address byte
scopeid long
return System.Diagnostics
        public IPAddress(byte[] address, long scopeid)
        {
            if (address == null)
            {
                throw new ArgumentNullException(nameof(address));
            }

            if (address.Length != IPAddressParserStatics.IPv6AddressBytes)
            {
                throw new ArgumentException(SR.dns_bad_ip_address, nameof(address));
            }

            _numbers = new ushort[NumberOfLabels];

            for (int i = 0; i < NumberOfLabels; i++)
            {
                _numbers[i] = (ushort)(address[i * 2] * 256 + address[i * 2 + 1]);
            }

            // Consider: Since scope is only valid for link-local and site-local
            //           addresses we could implement some more robust checking here
            if (scopeid < 0 || scopeid > 0x00000000FFFFFFFF)
            {
                throw new ArgumentOutOfRangeException(nameof(scopeid));
            }

            PrivateScopeId = (uint)scopeid;
        }

Same methods

IPAddress::IPAddress ( byte address ) : System.Diagnostics
IPAddress::IPAddress ( int newAddress ) : System.Diagnostics
IPAddress::IPAddress ( long newAddress ) : System.Diagnostics
IPAddress::IPAddress ( ushort numbers, uint scopeid ) : System.Diagnostics