c#获取本地IP地址
2021-01-17 09:13
标签:div write pad ip地址 lin 本地 network ipaddr res c#获取本地IP地址 标签:div write pad ip地址 lin 本地 network ipaddr res 原文地址:https://www.cnblogs.com/Angdybo/p/12200770.html string ipc = "";
string AddressIP = string.Empty;
foreach (IPAddress _IPAddress in Dns.GetHostEntry(Dns.GetHostName()).AddressList)
{
if (_IPAddress.AddressFamily.ToString() == "InterNetwork")
{
AddressIP = _IPAddress.ToString();
}
}
ipc = AddressIP;
Console.WriteLine(ipc);