In my C# application, I want to get my MAC address by using NetworkInterface
class as the following:
NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()
{
mac = nic.GetPhysicalAddress()
}
But this code returns the MAC without ':' or any other separator.
How can I retrieve the MAC in this format:
88:88:88:88:87:88
using the code above ONLY?
Where you want to show that, you have to do this:
Using the comment by eFloh for using BitConverter I was able to do the following (assuming
mac
is predefined as a string).try
The help for the command shows one way:
http://msdn.microsoft.com/en-us/library/system.net.networkinformation.physicaladdress.aspx
Try Something like this: