Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string GetMacAddress(string separator = ":")
- {
- //System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()
- foreach (var ni in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
- {
- var mac = ni.GetPhysicalAddress().ToString();
- for (int i = mac.Length - 2; i > 0; i -= 2)
- {
- mac = mac.Insert(i, separator);
- }
- Console.WriteLine($"Interface: {ni.Name} Mac {mac}");
- }
- string.Empty;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement