代码
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 }
15

 

相关文章:

  • 2022-12-23
  • 2021-10-24
  • 2021-09-16
  • 2022-12-23
  • 2021-12-26
  • 2021-10-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-27
  • 2021-11-19
  • 2021-07-19
  • 2022-12-23
相关资源
相似解决方案