// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Net.NetworkInformation; namespace EE { public class MainClass { public static void Main(string[] args) { NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces(); foreach(NetworkInterface nic in nics) { if(nic.GetPhysicalAddress().ToString().Length > 0 && nic.GetIPProperties().UnicastAddresses.Count > 0) { Console.WriteLine(nic.GetPhysicalAddress() + " " + nic.GetIPProperties().UnicastAddresses[0].Address); } } } } }