出现以下错误? [英] Getting following error?

查看:35
本文介绍了出现以下错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用时:

var nic = NetworkInterface.NetworkInterfaceType;

我包括 using System.Net.NetworkInformation;

我收到此错误:

'System.Net.NetworkInformation.NetworkInterface' does not contain a definition for 'NetworkInterfaceType'

我该如何解决这个错误?

How can I solve this error?

推荐答案

您正在将枚举类型分配给此行中的变量:

You are assigning an enumeration type to a variable in this line:

var nic = NetworkInterface.NetworkInterfaceType;

尝试使用此枚举类型的值之一:

Try using one of the values of this enumeration type:

var nic = NetworkInterface.NetworkInterfaceType.Unknown;

有关详细信息,请参阅这篇文章在这个枚举类型上.

See this article for more information on this enumeration type.

编辑

尝试删除 NetworkInterface 前缀:

var nic = NetworkInterfaceType.Unknown;

这篇关于出现以下错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆