C#获取本地IP地址
2012-06-05 /// <summary> /// 获取本地IP地址信息 /// </summary> void GetAddressIP() { ///获取本地的IP地址 string AddressIP = string.Empty; foreach (IPAddress _IPAddress in Dns.GetHostEntry(Dns.GetHostName()).AddressList) { if (_IPAddress.AddressFamily.ToString() == "InterNetwork") { AddressIP = _IPAddress.ToString(); } } txtLocalIP.Text = AddressIP; }