Map the IPAddress object to an IPv6 address in CSharp
Description
The following code shows how to map the IPAddress object to an IPv6 address.
Example
using System;/* w w w .j av a 2 s . c om*/
using System.Net;
using System.Net.Sockets;
public class Example
{
public static void Main()
{
string ipAddress = "127.0.0.1";
IPAddress address = IPAddress.Parse(ipAddress);
Console.WriteLine(address.MapToIPv6());
}
}
The code above generates the following result.