在csdn上看到有人问了这个问题,就道百度上查了一下,果然有,有事问百度,的确不是盖的!

View Code
        public static string Domain2Ip(string str)
{
string _return = "";
try
{
IPHostEntry hostinfo = Dns.GetHostEntry(str);
IPAddress[] aryIP = hostinfo.AddressList;
_return = aryIP[0].ToString();

}
catch (Exception e)
{
_return = e.Message;
}
return _return;
}

记在这里,自己也学习了!

相关文章:

  • 2021-09-30
猜你喜欢
  • 2022-12-23
  • 2021-10-19
  • 2021-12-21
  • 2021-12-21
  • 2022-01-29
  • 2021-11-04
相关资源
相似解决方案