1 /// <summary> 2 /// 获取本地的IP地址 3 /// </summary> 4 /// <returns></returns> 5 public static string GetAddressIP() 6 { 7 string AddressIP = string.Empty; 8 foreach (IPAddress _IPAddress in Dns.GetHostEntry(Dns.GetHostName()).AddressList) 9 { 10 if (_IPAddress.AddressFamily.ToString() == "InterNetwork") 11 { 12 AddressIP = _IPAddress.ToString(); 13 return AddressIP; 14 } 15 } 16 return AddressIP; 17 }
标签:return,string,C#,AddressIP,本地,IP地址,IPAddress,Dns From: https://www.cnblogs.com/smartnn/p/16775109.html