zoukankan      html  css  js  c++  java
  • ServiceController

     1 using System;
     2 using System.Collections.Generic;
     3 using System.Text;
     4 using System.ServiceProcess;
     5 
     6 namespace Study
     7 {
     8     public class ServiceInfo
     9    {
    10         public void ShowServiceInfo()
    11         {
    12             ServiceController[] services=System.ServiceProcess.ServiceController.GetServices();
    13             System.Console.WriteLine("Service名称 Service显示名称 Service状态");
    14             for (int i = 0; i < services.Length; i++)
    15             {
    16                 System.Console.WriteLine(string.Format("{0} {1} {2}", services[i].ServiceName, services[i].DisplayName, services[i].Status.ToString()));
    17             }
    18         }
    19     }

    20 }

    static void Main(string[] args)
           {
                ServiceInfo serviceInfo = new ServiceInfo();
                serviceInfo.ShowServiceInfo();
                Console.ReadLine();
            }

    21 
  • 相关阅读:
    Python函数高级
    Python 2和3的区别
    GIL,python全局解释器锁
    Python中的 list
    python中的单例
    新式类和经典类
    整理的排序算法
    Python的双下划方法
    Python 中闭包函数和装饰器
    面向对象,特性之继承
  • 原文地址:https://www.cnblogs.com/tonybinlj/p/1328815.html
Copyright © 2011-2022 走看看