ServiceController.CanStop : ServiceController « System.ServiceProcess « C# / C Sharp by API






ServiceController.CanStop

  

using System;
using System.ServiceProcess;

public class MainClass 
{
  public static void Main() 
  {
    ServiceController scAlerter = new ServiceController("Alerter");
    Console.WriteLine(scAlerter.DisplayName);
    Console.WriteLine(scAlerter.CanStop);
    scAlerter.Stop();
    Console.WriteLine("Service stopped");
    scAlerter.Start();
    Console.WriteLine("Service started");
  }
}

   
    
  








Related examples in the same category

1.new ServiceController
2.ServiceController.DisplayName
3.ServiceController.Stop()