C#通过域名获得IP地址的代码

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

using System.Net;
string web = txtWeb.Text;
IPHostEntry host = Dns.GetHostByName(web);
IPAddress ip = host.AddressList[0];
txtIp.Text = ip.ToString();