Loading

C# Host 转 IP 地址 (域名 转 IP)

 [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestMethod1()
        {
            // var isIp = IPAddress.TryParse("220.181.38.150", out var _);
            var addresses = Dns.GetHostAddresses("www.baidu.com");
            var ip = addresses[0].ToString();
        }
    }
posted @ 2021-07-22 22:04  microestc  阅读(348)  评论(0编辑  收藏  举报