Parse string to IP address in CSharp

Description

The following code shows how to parse string to IP address.

Example


using System;// w w  w  .ja  v  a  2 s . c  om
using System.Net;

class ParseAddress
{

  private static void Main(string[] args) 
  {
      string ipAddress = "127.0.0.1";
      IPAddress address = IPAddress.Parse(ipAddress);
      Console.WriteLine(address.ToString());
   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Network »




IP
Web Client