using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;

namespace JWH
{
    
    public static class ExtensionNetwork
    {

        /// <summary>
        /// Get PhysicalAddress (MAC Address)
        /// </summary>
        /// <returns></returns>
        public static string GetPhysicalAddress()
        {

            List<NetworkInterface> list = new List<NetworkInterface>();
            foreach(NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
            {
                if (nic.OperationalStatus == OperationalStatus.Up)
                    list.Add(nic);
            }

            return list[0].GetPhysicalAddress().ToString();
        }

    }

}
