I need to format an integer as a MAC-Address (01-1A-1B-2B-30 and so on). Is there a way to to this directly with string.format()? All my attepts so far have failed:
string.Format("{0:X}", 1234567); //Output: 12D687 It is hex, but not formatted
string.Format("{0:00-00-00-00}", 1234567); //Output: 01-23-45-67 Formatted, but not hex
string.Format("{0:00-00-00-00}", string.Format("{0:X}", 1234567)); //Output: 01-23-45-67 Also dosn't work and is ugly.
string.Format("{0:X00-00-00-00}", 1234567); //Output: X01-23-45-67 Well. Still no success here.
This will include a -
delimiter;
BitConverter.ToString(BitConverter.GetBytes(1234567))