IPAddress.GetAddressBytes 方法

定義

提供做為位元組陣列之 IPAddress 的複本。Provides a copy of the IPAddress as an array of bytes.

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

傳回

Byte[]

Byte 陣列。A Byte array.

範例

下列程式碼範例示範如何取得以位元組格式表示的伺服器 IP 位址。The following code example shows how to get a server IP address in byte format.

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

適用於