IPAddress IPAddress IPAddress IPAddress Constructors

定义

重载

IPAddress(Byte[]) IPAddress(Byte[]) IPAddress(Byte[]) IPAddress(Byte[])

使用指定为 IPAddress 数组的地址初始化 Byte 类的新实例。Initializes a new instance of the IPAddress class with the address specified as a Byte array.

IPAddress(Int64) IPAddress(Int64) IPAddress(Int64) IPAddress(Int64)

使用指定为 IPAddress 的地址初始化 Int64 类的新实例。Initializes a new instance of the IPAddress class with the address specified as an Int64.

IPAddress(ReadOnlySpan<Byte>) IPAddress(ReadOnlySpan<Byte>) IPAddress(ReadOnlySpan<Byte>) IPAddress(ReadOnlySpan<Byte>)
IPAddress(Byte[], Int64) IPAddress(Byte[], Int64) IPAddress(Byte[], Int64) IPAddress(Byte[], Int64)

使用指定为 IPAddress 数组的地址和指定的范围标识符初始化 Byte 类的新实例。Initializes a new instance of the IPAddress class with the address specified as a Byte array and the specified scope identifier.

IPAddress(ReadOnlySpan<Byte>, Int64) IPAddress(ReadOnlySpan<Byte>, Int64) IPAddress(ReadOnlySpan<Byte>, Int64) IPAddress(ReadOnlySpan<Byte>, Int64)

IPAddress(Byte[]) IPAddress(Byte[]) IPAddress(Byte[]) IPAddress(Byte[])

使用指定为 IPAddress 数组的地址初始化 Byte 类的新实例。Initializes a new instance of the IPAddress class with the address specified as a Byte array.

public:
 IPAddress(cli::array <System::Byte> ^ address);
public IPAddress (byte[] address);
new System.Net.IPAddress : byte[] -> System.Net.IPAddress
Public Sub New (address As Byte())

参数

address
Byte[]

IP 地址的字节数组值。The byte array value of the IP address.

异常

address 包含错误的 IP 地址。address contains a bad IP address.

注解

IPAddress使用创建Address属性设置为addressThe IPAddress is created with the Address property set to address.

如果的长度address为 4,IPAddress(Byte[])构造 IPv4 地址; 否则,构造包含的范围为 0 的 IPv6 地址。If the length of address is 4, IPAddress(Byte[]) constructs an IPv4 address; otherwise, an IPv6 address with a scope of 0 is constructed.

Byte数组被假定为与索引位置 0 中的第最高有效字节以网络字节顺序。The Byte array is assumed to be in network byte order with the most significant byte first in index position 0.

IPAddress(Int64) IPAddress(Int64) IPAddress(Int64) IPAddress(Int64)

使用指定为 IPAddress 的地址初始化 Int64 类的新实例。Initializes a new instance of the IPAddress class with the address specified as an Int64.

public:
 IPAddress(long newAddress);
public IPAddress (long newAddress);
new System.Net.IPAddress : int64 -> System.Net.IPAddress
Public Sub New (newAddress As Long)

参数

newAddress
Int64 Int64 Int64 Int64

IP 地址的长值。The long value of the IP address. 例如,大端格式的值 0x2414188f 可能为 IP 地址“143.24.20.36”。For example, the value 0x2414188f in big-endian format would be the IP address "143.24.20.36".

异常

newAddress< 0 或newAddress < 0 or newAddress> 0x00000000FFFFFFFFnewAddress > 0x00000000FFFFFFFF

注解

IPAddress使用创建实例Address属性设置为newAddressThe IPAddress instance is created with the Address property set to newAddress.

Int64值被假定为以网络字节顺序。The Int64 value is assumed to be in network byte order.

IPAddress(ReadOnlySpan<Byte>) IPAddress(ReadOnlySpan<Byte>) IPAddress(ReadOnlySpan<Byte>) IPAddress(ReadOnlySpan<Byte>)

public:
 IPAddress(ReadOnlySpan<System::Byte> address);
public IPAddress (ReadOnlySpan<byte> address);
new System.Net.IPAddress : ReadOnlySpan<byte> -> System.Net.IPAddress
Public Sub New (address As ReadOnlySpan(Of Byte))

参数

address
ReadOnlySpan<Byte>

IPAddress(Byte[], Int64) IPAddress(Byte[], Int64) IPAddress(Byte[], Int64) IPAddress(Byte[], Int64)

使用指定为 IPAddress 数组的地址和指定的范围标识符初始化 Byte 类的新实例。Initializes a new instance of the IPAddress class with the address specified as a Byte array and the specified scope identifier.

public:
 IPAddress(cli::array <System::Byte> ^ address, long scopeid);
public IPAddress (byte[] address, long scopeid);
new System.Net.IPAddress : byte[] * int64 -> System.Net.IPAddress
Public Sub New (address As Byte(), scopeid As Long)

参数

address
Byte[]

IP 地址的字节数组值。The byte array value of the IP address.

scopeid
Int64 Int64 Int64 Int64

范围标识符的长值。The long value of the scope identifier.

异常

address 包含错误的 IP 地址。address contains a bad IP address.

scopeid< 0 或scopeid < 0 or scopeid> 0x00000000FFFFFFFFscopeid > 0x00000000FFFFFFFF

注解

此构造函数实例化的 IPv6 地址。This constructor instantiates an IPv6 address. scopeid标识对于链接-本地地址的网络接口。The scopeid identifies a network interface in the case of a link-local address. 作用域是仅对链接-本地和站点本地地址有效。The scope is valid only for link-local and site-local addresses.

Byte数组被假定为与索引位置 0 中的第最高有效字节以网络字节顺序。The Byte array is assumed to be in network byte order with the most significant byte first in index position 0.

IPAddress(ReadOnlySpan<Byte>, Int64) IPAddress(ReadOnlySpan<Byte>, Int64) IPAddress(ReadOnlySpan<Byte>, Int64) IPAddress(ReadOnlySpan<Byte>, Int64)

public:
 IPAddress(ReadOnlySpan<System::Byte> address, long scopeid);
public IPAddress (ReadOnlySpan<byte> address, long scopeid);
new System.Net.IPAddress : ReadOnlySpan<byte> * int64 -> System.Net.IPAddress
Public Sub New (address As ReadOnlySpan(Of Byte), scopeid As Long)

参数

address
ReadOnlySpan<Byte>

适用于