标签:
C#获取本地IP地址
public static string GetLocalIp() { IPAddress localIp=null; try { IPAddress[] ipArray; ipArray=Dns.GetHostAddress(Dns.GetHostName()); localIp=ipArray.Frist(ip=>ip.AddressFamily==AddressFamily.InterNetwork); } catch(Exception ex) { } if(localIp==null) { localIp=IPAddress.Parse("127.0.0.1"); } return localIp.ToString(); }
标签:
原文地址:http://www.cnblogs.com/softwaredeveloper/p/5584728.html