C# is equivalent to Java's Thread.setDaemon, which is the concept of foreground and background threads.
When the foreground thread is closed, the background thread will also terminate. Foreground threads continue to run until the last foreground thread terminates.
The property used for background threads is IsBackground, which gets or sets a value indicating whether the thread is a background thread. The default value for this property is false because the default thread created is the foreground thread.
To create a thread daemon in C#, use isBackground -
Thread bgThread = new Thread(tStart); bgThread.IsBackground = true; bgThread.Start();
The above is the detailed content of C# equivalent to Java's Thread.setDaemon?. For more information, please follow other related articles on the PHP Chinese website!