What is threading in asp.net?
sajan vaghela
C# supports parallel execution of code through multithreading. A thread is an independent execution path, able to run simultaneously with other threads.
A C# client program (Console, WPF, or Windows Forms) starts in a single thread created automatically by the CLR and operating system (the “main” thread), and is made multithreaded by creating additional threads.
using System.Threading;
static void PrintHelloFromThreadName() { Console.WriteLine("Hello, from thread {0}", Thread.CurrentThread.Name); // {0} } public void ThreadStart() { PrintHelloFromThreadName(); } static void Main(string[] args) { Thread.CurrentThread.Name = "Main thread"; Class1 obj = new Class1(); Thread thread = new Thread( new ThreadStart(obj.ThreadStart)); thread.Name = "Forked thread"; thread.Start(); PrintHelloFromThreadName(); }