如何获得nic卡名称

Joh*_*ann 3 c# nic ethernet windows-server-2008-r2

任何人都知道如何获得尼卡名称

当我做ipconfig/all时我可以得到这个

Ethernet adapter XC99HT:

   Connection-specific DNS Suffix  . : xx.xx.com
   Description . . . . . . . . . . . : HP NC382i DP Multifunction Gigabit Server
 Adapter
   Physical Address. . . . . . . . . : F4-CE-46-94-E8-B0
   DHCP Enabled. . . . . . . . . . . : No
   Autoconfiguration Enabled . . . . : Yes
   IPv4 Address. . . . . . . . . . . : 177.77.153.48(Preferred)
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 177.77.153.1
   DNS Servers . . . . . . . . . . . : 177.77.124.129
                                       177.77.124.130
   Primary WINS Server . . . . . . . : 177.77.124.129
   Secondary WINS Server . . . . . . : 177.77.124.130
   NetBIOS over Tcpip. . . . . . . . : Enabled
Run Code Online (Sandbox Code Playgroud)

想通过使用/传递以太网名称"XC99HT"获得"HP NC382i DP多功能千兆服务器适配器"

小智 9

这样的东西?

public static void ShowInterfaceSummary()
Run Code Online (Sandbox Code Playgroud)

{

NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in interfaces)
{                
    Console.WriteLine ("Name: {0}", adapter.Name);
    Console.WriteLine(adapter.Description);
    Console.WriteLine(String.Empty.PadLeft(adapter.Description.Length,'='));
    Console.WriteLine("  Interface type .......................... : {0}", adapter.NetworkInterfaceType);
    Console.WriteLine("  Operational status ...................... : {0}", 
        adapter.OperationalStatus);
    string versions ="";

    // Create a display string for the supported IP versions.
    if (adapter.Supports(NetworkInterfaceComponent.IPv4))
    {
         versions = "IPv4";
     }
    if (adapter.Supports(NetworkInterfaceComponent.IPv6))
    {
        if (versions.Length > 0)
        {
            versions += " ";
         }
        versions += "IPv6";
    }
    Console.WriteLine("  IP version .............................. : {0}", versions);
    Console.WriteLine();
}
Console.WriteLine();
Run Code Online (Sandbox Code Playgroud)

}