class Program
{
public static void Main(String[] args)
{
var c = new C();
var thread = new Thread(new ThreadStart(c.F));
thread.Start
A process ends when all foreground threads terminate
From Thread.IsBackground remarks on foreground threads vs background threads:
A thread is either a background thread or a foreground thread. Background threads are identical to foreground threads, except that background threads do not prevent a process from terminating. Once all foreground threads belonging to a process have terminated, the common language runtime ends the process. Any remaining background threads are stopped and do not complete.
Any process which has running thread will not exit till all the threads are exited. So when the main thread exits it has another thread running and when the tread exits process gets terminated. To exit the program at any point of time Environment.Exit(0); should work. This statement will terminate all the treads and process will be terminated this is ungraceful way though