IPAddress.Loopback 字段

定义

提供 IP 环回地址。 此字段为只读。

public: static initonly System::Net::IPAddress ^ Loopback;
public static readonly System.Net.IPAddress Loopback;
 staticval mutable Loopback : System.Net.IPAddress
Public Shared ReadOnly Loopback As IPAddress 

字段值

示例

以下示例将 Loopback 地址打印到控制台。

void PrintLoopbackAddress()
{
   // Gets the IP loopback address and converts it to a string.
   String^ IpAddressString = IPAddress::Loopback->ToString();
   Console::WriteLine( "Loopback IP address : {0}", IpAddressString );
}
public void PrintLoopbackAddress()
{
  // Gets the IP loopback address and converts it to a string.
  String IpAddressString = IPAddress.Loopback.ToString();
  Console.WriteLine("Loopback IP address : " + IpAddressString);
}
Public Sub PrintLoopbackAddress()
    ' Gets the IP loopback address and converts it to a string.
    Dim IpAddressString As [String] = IPAddress.Loopback.ToString()
    Console.WriteLine(("Loopback IP address : " + IpAddressString))
End Sub

注解

字段 Loopback 等效于虚四边形表示法中的 127.0.0.1。

适用于