Merhaba ;
private static string GetMacAddress()
const int MIN_MAC_ADDR_LENGTH = 12;
string macAddress = “”;
long maxSpeed = -1;
string ID = “”;
foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
// MessageBox.Show(“Found MAC Address: ” + nic.GetPhysicalAddress().ToString() + ” Type: ” + nic.NetworkInterfaceType);
if (nic.GetPhysicalAddress().ToString() != “”)
ID = nic.GetPhysicalAddress().ToString();
string tempMac = nic.GetPhysicalAddress().ToString();
if (nic.Speed > maxSpeed && !String.IsNullOrEmpty(tempMac) && tempMac.Length >= MIN_MAC_ADDR_LENGTH)
// MessageBox.Show(“New Max Speed = ” + nic.Speed + “, MAC: ” + tempMac);
maxSpeed = nic.Speed;
macAddress = tempMac;
return (ID);
Şeklinde alabilirsiniz.Onu bir label’ada yazdırabiliriz.
label2.Text = GetMacAddress();
Şeklinde kolay gelsin.
c# Mac Adresi (ID) Alma Get Mac Id
Hiç yorum yok:
Yorum Gönder