Skip to content

Instantly share code, notes, and snippets.

Created November 25, 2015 00:35
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/ff82643c9a004281544a to your computer and use it in GitHub Desktop.
Save anonymous/ff82643c9a004281544a to your computer and use it in GitHub Desktop.
var address = NetworkInterface
.GetAllNetworkInterfaces()
.Where(i => i.NetworkInterfaceType == NetworkInterfaceType.Wireless80211 ||
i.NetworkInterfaceType == NetworkInterfaceType.Ethernet)
.SelectMany(i => i.GetIPProperties().UnicastAddresses)
.Where(a => a.Address.AddressFamily == AddressFamily.InterNetwork)
.Select(a => a.Address.ToString())
.ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment