- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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
Main thread vs child thread in C#
Main Thread
The first thread to be executed in a process is called the main thread. When a C# program starts execution, the main thread is automatically created.
Child Thread
The threads created using the Thread class are called the child threads of the main thread.
Here is an example showing how to create a main and child thread −
Example
using System; using System.Threading; namespace Demo { class Program { static void Main(string[] args) { Thread th = Thread.CurrentThread; th.Name = "MainThread"; Console.WriteLine("This is {0}", th.Name); Console.ReadKey(); } } }
Output
This is MainThread
- Related Articles
- User Thread vs Daemon Thread in Java?
- Controlling the main thread in Java
- Implement Runnable vs Extend Thread in Java
- How to fix "Exception in thread main" in java?
- Thread Pools in C#
- Thread Synchronization in C#
- Thread functions in C/C++
- How to get the thread ID from a thread in C#?
- Thread-based parallelism in C#
- Thread-Safe collections in C#
- Thread get_id() function in C++
- Check if a thread belongs to managed thread pool or not in C#
- How a thread can interrupt another thread in Java?
- How to check whether a thread is a background thread or not in C#
- Background and foreground thread in C#

Advertisements