TryParse Method

IPAddress.TryParse Method (String, IPAddress)

 

Determines whether a string is a valid IP address.

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

static member TryParse : 
        ipString:string *
        address:IPAddress byref -> bool

Parameters

ipString
Type: System.String

The string to validate.

address
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
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.1
Return to top
Show:
© 2016 Microsoft