Ajay
Ajay

Reputation: 6590

Getting following error?

When I use:

var nic = NetworkInterface.NetworkInterfaceType;

I Include using System.Net.NetworkInformation;

I get this error:

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

How can I solve this error?

Upvotes: 1

Views: 148

Answers (2)

NadaNK
NadaNK

Reputation: 802

NetworkInterface.NetworkInterfaceType is found in the Microsoft.Phone.Net.NetworkInformation library not in System.Net.NetworkInformation.

Upvotes: 0

Bernard
Bernard

Reputation: 7961

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.

Edit

Try removing the NetworkInterface prefix:

var nic = NetworkInterfaceType.Unknown;

Upvotes: 1

Related Questions