IPAddress.ToString 方法

定義

將網際網路位址轉換為其標準標記法。Converts an Internet address to its standard notation.

public:
 override System::String ^ ToString();
public override string ToString ();
override this.ToString : unit -> string
Public Overrides Function ToString () As String

傳回

字串,包含使用 IPv4 點分隔四組數字和 IPv6 冒號分隔十六進位之其中一種標記法的 IP 位址。A string that contains the IP address in either IPv4 dotted-quad or in IPv6 colon-hexadecimal notation.

例外狀況

位址家族是 InterNetworkV6,而且位址是錯誤的。The address family is InterNetworkV6 and the address is bad.

備註

ToString 方法會將儲存在 Address 屬性中的 IP 位址,轉換為 IPv4 帶點的四個或 IPv6 的冒號十六進位標記法。The ToString method converts the IP address that is stored in the Address property to either IPv4 dotted-quad or IPv6 colon-hexadecimal notation.

適用於