Reputation: 7110
Should I prefer one over the other?
Im leaning heavily towards NetworkInformation.IPGlobalProperties
instead of select * from win32_networkAdapterConfiguration
from WMI if I can verify that all the information I need is available
Upvotes: 2
Views: 500
Reputation: 8885
Use NetworkInformation
if you can and if it can provide everything you want. WMI is a much more generic interface that implements all sorts of things, and is a service that can be stopped or might not be available or even corrupted (it has happened to me a few times). NetworkInformation
I believe is a wrapper around the Win32 APIs so it should almost always work and have no dependencies (besides .NET 3.0+).
Always better to use the simplest and more specific tool that gets the job done.
Upvotes: 2