Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello sir .
i am very thank full to you because i got very much knowledge from your blogs.

i have query about how to make MAC addresses based software in c# , so it can be use one software copy for one PC (MAC).

i will be thank full to you if you can help me out.
thank you :)
Posted

1 solution

from msdn:
https://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface.getphysicaladdress(v=vs.110).aspx[^]

C#
 public static void DisplayTypeAndAddress()
{
    IPGlobalProperties computerProperties = IPGlobalProperties.GetIPGlobalProperties();
    NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
    Console.WriteLine("Interface information for {0}.{1}     ",
            computerProperties.HostName, computerProperties.DomainName);
    foreach (NetworkInterface adapter in nics)
    {
        IPInterfaceProperties properties = adapter.GetIPProperties();
        Console.WriteLine(adapter.Description);
        Console.WriteLine(String.Empty.PadLeft(adapter.Description.Length,'='));
        Console.WriteLine("  Interface type .......................... : {0}", adapter.NetworkInterfaceType);
        Console.WriteLine("  Physical Address ........................ : {0}", 
                   adapter.GetPhysicalAddress().ToString());
        Console.WriteLine("  Is receive only.......................... : {0}", adapter.IsReceiveOnly);
        Console.WriteLine("  Multicast................................ : {0}", adapter.SupportsMulticast);
        Console.WriteLine();
      }
   }


Oh, PS: it's the Physical Address you want ;)
 
Share this answer
 
v2
Comments
Ashish Tyagi 40 18-May-15 11:58am    
Good one, my 5.
Andy Lanng 18-May-15 12:17pm    
ty: I just wish some of my solutions got accepted :/
5*'s makes up for it ;Þ

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900