WPF教程

WPF 获取本地IP地址--WPF教程

时间:2013-7-23 22:22:41  作者:WPF之家  来源:http://www.wpf123.com  查看:2827  评论:0
内容摘要:/// <summary>/// 获取本地IP地址信息/// </summary>void GetAddressIP(){///获取本地的IP地址string AddressIP = string.Empty;foreach (IPAddress _IPA...

/// <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;
}

 

标签:获取 本地 地址 WPF 获取本地IP地址 

原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。本文出自“wpf之家”,请务必保留此出处:http://www.wpf123.com

相关评论
Copyright © 2009-2014 WPF之家(http://www.wpf123.com/) All rights reserved
 Powered by WPF之家
鄂ICP备13006396号