IPAddress.GetAddressBytes 方法

定义

按网络顺序提供 作为字节数组的副本 IPAddress

public:
 cli::array <System::Byte> ^ GetAddressBytes();
public byte[] GetAddressBytes ();
member this.GetAddressBytes : unit -> byte[]
Public Function GetAddressBytes () As Byte()

返回

Byte[]

Byte 数组。

示例

下面的代码示例演示如何获取字节格式的服务器 IP 地址。

array<Byte>^bytes = curAdd->GetAddressBytes();
for ( int i = 0; i < bytes->Length; i++ )
{
   Console::Write( bytes[ i ] );

}
Byte[] bytes = curAdd.GetAddressBytes();
for (int i = 0; i < bytes.Length; i++)
{
  Console.Write(bytes[i]);
}
Dim bytes As [Byte]() = curAdd.GetAddressBytes()
Dim i As Integer
For i = 0 To bytes.Length - 1
  Console.Write(bytes(i))
Next i

适用于