title: How to run console app in background [C#]
body: <p>I want to run this code in a background (no console showing up), so I changed the output type to <strong>Windows Application</strong> but then the program doesn't work.</p>
  
  <p>When I change the output back to <strong>Console Application</strong>, then everything works, but it is not running in the background... If you know any better solution, or you know an already written software which does the same thing please comment it here :)</p>
  
  <p><em>The code is basically copying text to clipboard from a resource when a key is pressed.</em></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  using System.Windows.Forms;
  using System.Resources;
  using System.Reflection;
  
  namespace EzClipBoard
  {
      class Program
      {
          [STAThreadAttribute]
          static void Main(string[] args)
          {
              int exit = 1;
              string bubblesort = codes.ResourceManager.GetString("bubblesort");
              string insertion = codes.ResourceManager.GetString("insertion");
  
              while(exit != 0)
              {
                  if (Console.ReadKey(true).Key == ConsoleKey.X)
                  {
                      Clipboard.SetText(bubblesort);
                  }
  
                  else if (Console.ReadKey(true).Key == ConsoleKey.Y)
                  {
                      Clipboard.SetText(insertion);
                  }
  
                  else if (Console.ReadKey(true).Key == ConsoleKey.Escape)
                  {
                      exit = 0;
                  }
  
              }
          }
      }
  }
  </code></pre>