Report information from NetworkInterface: physical address : NetworkInterface « Network « C# / CSharp Tutorial






using System;
using System.Net.NetworkInformation;

class MainClass
{
    static void Main()
    {
        if (!NetworkInterface.GetIsNetworkAvailable())
           return;

        NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();

        foreach (NetworkInterface ni in interfaces)
        {
            Console.WriteLine("    Physical Address: {0}",  ni.GetPhysicalAddress().ToString());
        }
    }
}
Physical Address: 0014A51190DC
    Physical Address: 00C09FC5BD14
    Physical Address:








33.34.NetworkInterface
33.34.1.Report information from NetworkInterface: name, description, id, type, speed, status
33.34.2.Report information from NetworkInterface: physical address
33.34.3.Report information from NetworkInterface: network statistics
33.34.4.Report information from NetworkInterface: IP address and DHCP Expires (DhcpLeaseLifetime)