Just think, when we need threading in development! When we have some long time taking task to be completed, and at the same time user should be able to perform other task without being interrupted, in that situation we use threading.
Now let's look at below threading code sample
Now we write a function for long time taking task that will Fetch 100000 records from database
and send customized email to each user
public static void MyLongTask1()
List< object> objCollection = null;
foreach (object o in objCollection)
// here we can do any database task or sending email.
// Here we fetch 100000 records from database and send them customized email
System.Console.WriteLine("Processing... my thread running");
Now we create a thread object and call that function
Thread MyThread = new Thread(new ThreadStart(MyLongTask1));