Пример #1
0
        public static List<Adapter> GetAdapters()
        {
            List<Adapter> adapterList = new List<Adapter>();
            string query = "SELECT * FROM Win32_NetworkAdapterConfiguration";

            System.Management.ManagementObjectSearcher searcher;
            System.Management.ObjectQuery q = new System.Management.ObjectQuery(query);
            searcher = new System.Management.ManagementObjectSearcher(q);
            foreach(System.Management.ManagementObject share in searcher.Get()) {
                Adapter ad = new Adapter();
                ad.PropertyData = share;
                adapterList.Add(ad);
            }
            return adapterList;
        }
Пример #2
0
        public static List<Adapter> GetAdapters()
        {
            List<Adapter> adapterList = new List<Adapter>();

            ObjectQuery q = new ObjectQuery("SELECT * FROM Win32_NetworkAdapterConfiguration");
            ManagementObjectSearcher searcher = new ManagementObjectSearcher(q);
            foreach (ManagementObject share in searcher.Get())
            {
                Adapter ad = new Adapter {PropertyData = share};
                adapterList.Add(ad);
            }

            return adapterList;
        }