---
title: "Multithreading"  
description: "In C# multithreading is  a way to implement multitasking.Exampleforint i = 1; i         //creating thread for display() method  Thread t = newThreadne"  
author: "Uttam Misra"  
published: 2010-07-15  
updated: 2020-03-04  
canonical: https://www.mindstick.com/articles/85/multithreading  
category: "c#"  
tags: ["c#"]  
reading_time: 1 minute  

---

# Multithreading

In C# multithreading is a way to implement multitasking.

##### Example

```
  for (int i = 1; i <= 5;i++)    {      //creating thread for display() method      Thread t = new Thread(new ThreadStart(display));       //starting thread.      t.Start();    }       int i =0;         public void display()   {    i++;      //displaying messagebox.    MessageBox.Show(i.ToString());              }
```

Screen Shot

![Multithreading](https://www.mindstick.com/mindstickarticle/15bf9ed2-b654-4795-9344-a7b433fb55b2/images/9ec8de07-d31e-449f-9327-0f4273c40bd0.png)\

Here we can see that all five message boxes are displayed. But if we had not used

\

threading then only one message box will be displayed and second box will be

\

displayed only after clicking on OK button of first Message Box. All five message

\

boxes are displayed simultaneously as different thread are created for display()

\

method called from loop.

---

Original Source: https://www.mindstick.com/articles/85/multithreading

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
