To handle Domain Name System (DNS) name resolution, use the Dns class Resolve method. The following example demonstrates how to implement this.
using System;
using System.Net;
namespace Client.Chapter_14___Networking_and_WWW_Connections
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
IPHostEntry MyHost = Dns.Resolve(args[0]);
foreach (IPAddress MyIP in MyHost.AddressList)
{
Console.WriteLine(MyIP.Address);
}
}
}
}