IPAddress.IPv6Loopback 欄位
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
提供 IP 回送位址。 這個屬性是唯讀的。
public: static initonly System::Net::IPAddress ^ IPv6Loopback;
public static readonly System.Net.IPAddress IPv6Loopback;
staticval mutable IPv6Loopback : System.Net.IPAddress
Public Shared ReadOnly IPv6Loopback As IPAddress
欄位值
範例
下列程式代碼範例會以標準壓縮格式顯示目前主機回送位址的值。
// This method displays the value of the current host loopback address in
// standard compressed format.
void displayIPv6LoopBackAddress()
{
try
{
// Get the loopback address.
IPAddress^ loopBack = IPAddress::IPv6Loopback;
// Transform the loop-back address to a string using the overladed
// ToString() method. Note that the resulting string is in the compact
// form: "::1".
String^ ipv6LoopBack = loopBack->ToString();
Console::WriteLine( "The IPv6 Loopback address is: {0}", ipv6LoopBack );
}
catch ( Exception^ e )
{
Console::WriteLine( "->Item[displayIPv6LoopBackAddress] Exception: {0}", e );
}
}
// This method displays the value of the current host loopback address in
// standard compressed format.
private static void displayIPv6LoopBackAddress()
{
try
{
// Get the loopback address.
IPAddress loopBack = IPAddress.IPv6Loopback;
// Transform the loop-back address to a string using the overladed
// ToString() method. Note that the resulting string is in the compact
// form: "::1".
string ipv6LoopBack = loopBack.ToString();
Console.WriteLine("The IPv6 Loopback address is: " + ipv6LoopBack);
}
catch (Exception e)
{
Console.WriteLine("[displayIPv6LoopBackAddress] Exception: " + e.ToString());
}
}
' This methods prints the value of the current host loopback address in
' standard compressed format.
Private Shared Sub printIPv6LoopBackAddress()
Try
' Get the loopback address.
Dim loopBack As IPAddress = IPAddress.IPv6Loopback
' Transform the loop-back address to a string using the overloaded
' ToString() method. Note that the resulting string is in the compact
' form: "::1".
Dim ipv6LoopBack As String = loopBack.ToString()
Console.WriteLine(("The IPv6 Loopback address is: " + ipv6LoopBack))
Catch e As Exception
Console.WriteLine(("[printIPv6LoopBackAddress] Exception: " + e.ToString()))
End Try
End Sub
備註
欄位 IPv6Loopback 相當於冒號十六進位表示法中的 0:0:0:0:0:0:1,或在壓縮表示法中等於 ::1。