- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# equivalent to Java's Thread.setDaemon?
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();
Advertisements