Sie sind auf Seite 1von 1

using System;

using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;

namespace Class_Assignment
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Thread t;
private void button1_Click(object sender, EventArgs e)
{
int n = 10;
t = new Thread(()=>dosomething(n)){ Name="Taimoor ahmed"};
t.Start();

}
void dosomething(int n)
{
for (int i = 0; i <= n; i++)
{
var name = Thread.CurrentThread.Name;
Console.WriteLine(name +" "+ i);

}
}

Das könnte Ihnen auch gefallen