ServiceController.DependentServices Propriété
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Obtient le jeu de services qui dépend du service associé à cette instance de ServiceController.
public:
property cli::array <System::ServiceProcess::ServiceController ^> ^ DependentServices { cli::array <System::ServiceProcess::ServiceController ^> ^ get(); };
public System.ServiceProcess.ServiceController[] DependentServices { get; }
[System.ServiceProcess.ServiceProcessDescription("SPDependentServices")]
public System.ServiceProcess.ServiceController[] DependentServices { get; }
member this.DependentServices : System.ServiceProcess.ServiceController[]
[<System.ServiceProcess.ServiceProcessDescription("SPDependentServices")>]
member this.DependentServices : System.ServiceProcess.ServiceController[]
Public ReadOnly Property DependentServices As ServiceController()
Valeur de propriété
Tableau d'instances de ServiceController, dont chacune est associée à un service qui dépend de ce service.
- Attributs
Exceptions
Une erreur s'est produite lors de l'accès à une API système.
Le service est introuvable.
Exemples
L’exemple suivant utilise la classe pour afficher l’ensemble ServiceController de services qui dépendent du service Journal des événements.
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
Remarques
Le DependentServices tableau représente les services que le système arrête si votre application appelle Stop ce service.