IPAddress.TryParse Method (String, IPAddress)


Determines whether a string is a valid IP address.

Namespace:   System.Net
Assembly:  System (in System.dll)

public static bool TryParse(
	string ipString,
	out IPAddress address


Type: System.String

The string to validate.

Type: System.Net.IPAddress

The IPAddress version of the string.

Return Value

Type: System.Boolean

true if ipString was able to be parsed as an IP address; otherwise, false.

Note that TryParse returns true if it parsed the input successfully, but that this does not necessarily mean that the resulting IP address is a valid one. Do not use this method to validate IP addresses.

Universal Windows Platform
Available since 10
.NET Framework
Available since 2.0
Available since 2.0
Windows Phone Silverlight
Available since 7.1
Return to top