如何使用.NET/C#将域名解析为IP地址?

Ant*_*ley 28 .net c# dns reverse-dns

如何使用.NET/C#将域名解析为IP地址?

lub*_*sko 19

using System.Net;

foreach (IPAddress address in Dns.GetHostAddresses("www.google.com"))
{
   Console.WriteLine(address.ToString());
}
Run Code Online (Sandbox Code Playgroud)