title: How to get windows service name from app.config
body: <p>i have a app.config</p>
  
  <pre><code>  &lt;appSettings&gt;
      &lt;add key="ServiceName" value="HasService"/&gt;
      &lt;add key="ServiceDisplayName" value="HasService"/&gt;
    &lt;/appSettings&gt;
  </code></pre>
  
  <p>my service installer class </p>
  
  <pre><code> [RunInstaller(true)]
      public class MyServiceInstaller : System.Configuration.Install.Installer
      {
          public MyServiceInstaller()
          {
              var process = new ServiceProcessInstaller {Account = ServiceAccount.LocalSystem};
              var serviceAdmin = new ServiceInstaller
              {
                  StartType = ServiceStartMode.Manual,
                  ServiceName = "HasService",
                  DisplayName = "HasService"
              };
              Installers.Add(process);
              Installers.Add(serviceAdmin);
          }
      }
  </code></pre>
  
  <p>i want to get service name from app.config.</p>
  
  <pre><code>    var serviceAdmin = new ServiceInstaller
      {
          StartType = ServiceStartMode.Manual,
          ServiceName = GetServiceNameAppConfig("ServiceName"),
          DisplayName = GetServiceNameAppConfig("ServiceDisplayName")
      };
  
      public string GetServiceNameAppConfig(string serviceName)
      {
          //what should i write here?
      }
  </code></pre>
  
  <p>how to get service name and service display name from app.config file in MyServiceInstaller class.</p>