What is a Thread?

Threads let us run multiple sections of code simultaneously. Threading allows the code to run on multiple processors, boosting performance.

To use threads, include the following at the top of the page:

using System.Threading; // C # 10 comes with ImplicitUsings, meaning the most popular using namespaces such as this one are already built-in so there is no need to declare it

The Thread class constructor used below contains a delegate that accepts methods that return void. Only methods that return void can be used.

Get hands-on with 1200+ tech skills courses.