簡單獲取電腦ip和計算機名

网络来者發表於2024-08-21

string localIP = Dns.GetHostEntry(Dns.GetHostName()).AddressList
.FirstOrDefault(ip => ip.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork && ip.ToString().StartsWith("10"))?.ToString();


string computerName = Environment.MachineName;

estool.info(computerName +" " + localIP);

相關文章