Aracılığıyla paylaş


NetworkInterface.OperationalStatus Özellik

Tanım

Ağ bağlantısının geçerli işletim durumunu alır.

public:
 virtual property System::Net::NetworkInformation::OperationalStatus OperationalStatus { System::Net::NetworkInformation::OperationalStatus get(); };
public:
 abstract property System::Net::NetworkInformation::OperationalStatus OperationalStatus { System::Net::NetworkInformation::OperationalStatus get(); };
public virtual System.Net.NetworkInformation.OperationalStatus OperationalStatus { get; }
public abstract System.Net.NetworkInformation.OperationalStatus OperationalStatus { get; }
member this.OperationalStatus : System.Net.NetworkInformation.OperationalStatus
Public Overridable ReadOnly Property OperationalStatus As OperationalStatus
Public MustOverride ReadOnly Property OperationalStatus As OperationalStatus

Özellik Değeri

Değerlerden OperationalStatus biri.

Örnekler

Aşağıdaki kod örneği, yerel bilgisayardaki tüm arabirimler için bir özet görüntüler.

void ShowInterfaceSummary()
{
   array<NetworkInterface^>^interfaces = NetworkInterface::GetAllNetworkInterfaces();
   System::Collections::IEnumerator^ myEnum5 = interfaces->GetEnumerator();
   while ( myEnum5->MoveNext() )
   {
      NetworkInterface ^ adapter = safe_cast<NetworkInterface ^>(myEnum5->Current);
      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 = String::Concat( versions, " " );
         }

         versions = String::Concat( versions, "IPv6" );
      }

      Console::WriteLine( "  IP version .............................. : {0}", versions );
      Console::WriteLine();
   }

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

Açıklamalar

İşlem durumu değerleri numaralandırma belgelerinde OperationalStatus ayrıntılı olarak açıklanmıştır.

Şunlara uygulanır