ServiceController.ServicesDependedOn Property
.NET Framework 2.0
The set of services that this service depends on.
Namespace: System.ServiceProcess
Assembly: System.ServiceProcess (in system.serviceprocess.dll)
Assembly: System.ServiceProcess (in system.serviceprocess.dll)
/** @property */ public ServiceController[] get_ServicesDependedOn ()
public function get ServicesDependedOn () : ServiceController[]
Property Value
An array of ServiceController instances, each of which is associated with a service that must be running for this service to run.The following example uses the ServiceController class to display the set of services that the Messenger service is dependent on.
ServiceController sc = new ServiceController("Messenger"); ServiceController[] scServices= sc.ServicesDependedOn; // Display the services that the Messenger service is dependent on. if (scServices.Length == 0) { Console.WriteLine("{0} service is not dependent on any other services.", sc.ServiceName); } else { Console.WriteLine("{0} service is dependent on the following:", sc.ServiceName); foreach (ServiceController scTemp in scServices) { Console.WriteLine(" {0}", scTemp.DisplayName); } }
ServiceController sc = new ServiceController("Messenger");
ServiceController scServices[] = sc.get_ServicesDependedOn();
// Display the services that the Messenger service is dependent on.
if (scServices.length == 0) {
Console.WriteLine("{0} service is not dependent on any other "
+ "services.", sc.get_ServiceName());
}
else {
Console.WriteLine("{0} service is dependent on the following:",
sc.get_ServiceName());
ServiceController scTemp = null;
for (int iCtr = 0; iCtr < scServices.get_Length(); iCtr++) {
scTemp = scServices[iCtr];
Console.WriteLine(" {0}", scTemp.get_DisplayName());
}
}
- ServiceControllerPermission for connecting to existing services on the computer. Associated enumeration: ServiceControllerPermissionAccess.Browse
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .
Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.