I know this was answered a while ago, but I just wanted to clarify that the preferred solution is usually to create a reusable extension method for the PhysicalAddress class.
Since it is a simple data class, and is likely not to change, this is better for reusability reasons.
I will use Lorenzo's example because I like it the most, but you can use whichever routine suits you.
public static class PhysicalAddressExtensions
{
public static string ToString(this PhysicalAddress address, string separator)
{
return string.Join(separator, address.GetAddressBytes()
.Select(x => x.ToString("X2")))
}
}
Now you can just use the extension method from now on like this:
NetworkInterface[] arr = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface item in arr)
{
PhysicalAddress mac = item.GetPhysicalAddress();
string stringFormatMac = mac.ToString(":");
}
Remember that the PhysicalAddress.Parse only accepts the RAW hex or dash separated values, in case you wanted to parse it back into an object. So stripping the separator character before you parse is important.