1 //可以通过比较 NetworkInterface 的 NetworkInterfaceType 筛选不需要的内容
2 NetworkInterface[] nis = NetworkInterface.GetAllNetworkInterfaces();
3 foreach (NetworkInterface ni in nis)
4 {
5 PhysicalAddress pa = ni.GetPhysicalAddress();
6 string mac = pa.ToString();
7 }
8
9 string myHostName = Dns.GetHostName();
10 IPHostEntry ips = Dns.GetHostEntry(myHostName);
11 foreach (IPAddress ip in ips.AddressList)
12 {
13 string ipString = ip.ToString();
14 }
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12639172/viewspace-628254/ ,如需转载,请注明出处,否则将追究法律责任。