C# equivalent to Java's Thread.setDaemon is the concept of foreground and background threads.
When the foreground threads will close, the background threads will be terminated. Foreground threads continue to run until the last foreground thread is terminated.
The property used for background thread is IsBackground that gets or sets a value indicating whether a thread is a background thread. The default value of this property would be false because the default threads created are Foreground Threads.
To make a thread Daemon in C#, use the isBackground −
Thread bgThread = new Thread(tStart); bgThread.IsBackground = true; bgThread.Start();