Ayush Ayush - 2 months ago 5x
C# Question

Default threading model for a .Net application

I am new to programming, so please pardon me for if the question is a silly one-

I want to know that, in an ordinary C# program where we don't create multi-threads manually in the code, does the whole program run on a single main thread OR
there are some other threads created for the execution of program?


Short answer, there are other threads with the main thread that are required to support the application.

This can be tested in Visual Studio.

Create a simple Console application. Put a debug point, and start debugging. Once the application gets to that debug point, open "Threads" windows by

Debug -> Windows -> Threads 

You will see something like:

enter image description here

Some of the above threads are for debugger, but mostly an app would have main thread, GC (Garbage Collection) and Finalizer thread etc.