C#通过域名获得IP地址的代码 2015/04/24 14464 using System.Net; string web = txtWeb.Text; IPHostEntry host = Dns.GetHostByName(web); IPAddress ip = host.AddressList[0]; txtIp.Text = ip.ToString();