CSharp examples for Network:IP Address
Get Mac Address
using System.Diagnostics; using System.Management; using System.Text; using System.Collections.Generic; using System;/*from ww w . j av a 2s.c om*/ public class Main{ public static IList<string> GetMacAddress() { ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementObjectCollection moc = mc.GetInstances(); IList<string> strArr = new List<string>(); foreach (ManagementObject mo in moc) { if ((bool)mo["IPEnabled"]) { strArr.Add(mo["MacAddress"].ToString().Replace(":", "")); } mo.Dispose(); } return strArr; } }