We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 7
Threading in c#
Two for loops Running
Threading
Threading in C# refers to the ability to execute multiple sequences
of code (called threads) simultaneously within the same process. Each thread runs independently and can perform tasks concurrently, allowing for multitasking. In C#, the Thread class from the System.Threading namespace is used to create and manage threads. Multithreading is the process of running multiple threads concurrently. It allows an application to handle multiple tasks at the same time. Every C# application starts with a single thread, called the main thread, which is responsible for running the Main() method. How to create a Thread Types of Thread
Foreground Thread-Foreground threads continue to run until they
complete their execution, even if the main application thread terminates. The application will not terminate until all foreground threads have finished. Foreground threads is created if any thread user create using the Thread class. Background threads – Background threads run as long as the main application thread is running. Once all foreground threads finish, the application will terminate, even if background threads are still running. Used for tasks that are not critical to the application, like logging or background maintenance. Can be set by setting the IsBackground property of the Thread object Foreground thread Background thread