OperationalStatus Enum

Definition

Specifies the operational state of a network interface.

C#
public enum OperationalStatus
Inheritance
OperationalStatus

Fields

Name Value Description
Up 1

The network interface is up; it can transmit data packets.

Down 2

The network interface is unable to transmit data packets.

Testing 3

The network interface is running tests.

Unknown 4

The network interface status is not known.

Dormant 5

The network interface is not in a condition to transmit data packets; it is waiting for an external event.

NotPresent 6

The network interface is unable to transmit data packets because of a missing component, typically a hardware component.

LowerLayerDown 7

The network interface is unable to transmit data packets because it runs on top of one or more other interfaces, and at least one of these "lower layer" interfaces is down.

Examples

The following code example displays a summary for all interfaces on the local computer.

C#
public static void ShowInterfaceSummary()
{

    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();
}

Remarks

This enumeration defines valid values for the OperationalStatus property.

Applies to

Product Versions
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1