Get Wireless Mac Address List - CSharp Network

CSharp examples for Network:IP Address

Description

Get Wireless Mac Address List

Demo Code

// All Rights Reserved , Copyright (C) 2012 , Hairihan TECH, Ltd. 
using System.Net.NetworkInformation;
using System.Net;
using System.Management;
using System.Collections.Generic;

public class Main{

        public static List<string> GetWirelessMacAddressList()
        {//from w w w .j  a v a 2  s. co m
            List<string> macAddressList = new List<string>();
            NetworkInterface[] networkInterfaces = NetworkInterface.GetAllNetworkInterfaces();
            foreach (NetworkInterface ni in networkInterfaces)
            {
                if (ni.Description.Contains("Wireless") && ni.OperationalStatus == OperationalStatus.Up)
                {
                    macAddressList.Add(ni.GetPhysicalAddress().ToString());
                }
            }
            return macAddressList;
        }
}

Related Tutorials