Skip to content

Instantly share code, notes, and snippets.

@LucasBonafe
Created September 17, 2017 01:50
Show Gist options
  • Save LucasBonafe/2124e6fdd9152e39565dc028e854aa16 to your computer and use it in GitHub Desktop.
Save LucasBonafe/2124e6fdd9152e39565dc028e854aa16 to your computer and use it in GitHub Desktop.
Creates a variable and assigns the MAC address to it in only 1 line of code.
var MACaddr=NetworkInterface.GetAllNetworkInterfaces().Where(nic => nic.OperationalStatus == OperationalStatus.Up).Select(nic => nic.GetPhysicalAddress().ToString()).FirstOrDefault();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment