foreach (System.Net.NetworkInformation.NetworkInterface f in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces()) { if (f.OperationalStatus == System.Net.NetworkInformation.OperationalStatus.Up) { var i = f.GetIPProperties().DhcpServerAddresses.Count; } }
原文:https://www.cnblogs.com/xinzheng/p/12837847.html