IPAddress.ToString 方法

定义

将 Internet 地址转换为标准表示法。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

返回

String

包含 IP 地址(IPv4 使用点分四组表示法,IPv6 使用冒号十六进制表示法)的字符串。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方法会将存储在属性中的 IP 地址转换 Address 为 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.

适用于