Source

ReportMAC / Form1.cs

Full commit
using System;
using System.Text;
using System.Windows.Forms;
using System.Net.NetworkInformation;

namespace ReportMAC {
	public partial class Form1 : Form {
		public Form1() {
			InitializeComponent();

			NetworkInterface[] ifaces = System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces();
			foreach (NetworkInterface iface in ifaces) {
				byte[] addressBytes = iface.GetPhysicalAddress().GetAddressBytes();
				if (addressBytes.Length > 0) {
					textBox1.AppendText(iface.Name + " = " + ConvertAddress(addressBytes) + "\n");
				}
			}
		}

		private static String ConvertAddress(byte[] inAddress) {
			StringBuilder outAddress = new StringBuilder();
			for (int i = 0, j = inAddress.Length; i < j; i++) {
				outAddress.Append(inAddress[i].ToString("X2"));
				if (i < (j - 1)) {
					outAddress.Append(":");
				}
			}

			return outAddress.ToString();
		}
	}
}