ServiceController.DependentServices ServiceController.DependentServices ServiceController.DependentServices ServiceController.DependentServices Property

Definizione

Ottiene il set di servizi che dipende dal servizio associato a questa istanza di ServiceController.Gets the set of services that depends on the service associated with this ServiceController instance.

public:
 property cli::array <System::ServiceProcess::ServiceController ^> ^ DependentServices { cli::array <System::ServiceProcess::ServiceController ^> ^ get(); };
[System.ServiceProcess.ServiceProcessDescription("SPDependentServices")]
public System.ServiceProcess.ServiceController[] DependentServices { get; }
member this.DependentServices : System.ServiceProcess.ServiceController[]
Public ReadOnly Property DependentServices As ServiceController()

Valore della proprietà

Matrice di istanze di ServiceController, ciascuna delle quali è associata a un servizio che dipende dal servizio corrente.An array of ServiceController instances, each of which is associated with a service that depends on this service.

Eccezioni

Si è verificato un errore durante l'accesso a un'API di sistema.An error occurred when accessing a system API.

Esempi

Nell'esempio seguente viene utilizzata ServiceController la classe per visualizzare il set di servizi che dipendono dal servizio Registro eventi.The following example uses the ServiceController class to display the set of services that are dependent on the Event Log service.

ServiceController^ sc = gcnew ServiceController(  "Event Log" );
array<ServiceController^>^scServices = nullptr;
if ( sc )
{
   scServices = sc->DependentServices;
}

if ( sc && scServices )
{
   // Display the list of services dependent on the Event Log service.
   if ( scServices->Length == 0 )
   {
      Console::WriteLine(  "There are no services dependent on {0}", sc->ServiceName );
   }
   else
   {
      Console::WriteLine(  "Services dependent on {0}:", sc->ServiceName );
      for each (ServiceController^ scTemp in scServices)
      {
         Console::WriteLine(" {0}", scTemp->DisplayName);
      }
   }
}

ServiceController sc =  new ServiceController("Event Log");
ServiceController[] scServices = sc.DependentServices;

// Display the list of services dependent on the Event Log service.
if (scServices.Length == 0)
{
   Console.WriteLine("There are no services dependent on {0}", 
                      sc.ServiceName);
}
else 
{
   Console.WriteLine("Services dependent on {0}:",
                      sc.ServiceName);

   foreach (ServiceController scTemp in scServices)
   {
      Console.WriteLine(" {0}", scTemp.DisplayName);
   }
}


Dim sc As New ServiceController("Event Log")
Dim scServices As ServiceController() = sc.DependentServices

' Display the list of services dependent on the Event Log service.
If scServices.Length = 0 Then
   Console.WriteLine("There are no services dependent on {0}", sc.ServiceName)
Else
   Console.WriteLine("Services dependent on {0}:", sc.ServiceName)
   
   Dim scTemp As ServiceController
   For Each scTemp In  scServices
      Console.WriteLine(" {0}", scTemp.DisplayName)
   Next scTemp
End If

Commenti

La DependentServices matrice rappresenta i servizi che il sistema arresta se l'applicazione chiama Stop per il servizio.The DependentServices array represents the services that the system stops if your application calls Stop for this service.

Sicurezza

ServiceControllerPermission
per la connessione ai servizi esistenti nel computer.for connecting to existing services on the computer. Enumerazione associata:BrowseAssociated enumeration: Browse

Si applica a