You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
757 B
C#

/*
* C# Program to Illustrate the Concept of Passing Parameter for Thread
*/
using System;
using System.Threading;
public class pgm
{
public static void Main()
{
Thread newThread = new Thread(pgm.work1);
newThread.Start(20);
pgm p = new pgm();
newThread = new Thread(p.work2);
newThread.Start("Instance");
Console.ReadLine();
}
public static void work1(object data)
{
Console.WriteLine("Static Thread Procedure : Data ='{0}'",data);
}
public void work2(object data)
{
Console.WriteLine("Instance Thread Procedure : Data ='{0}'", data);
}
}
/*
Static Thread Procedure : Data = '20'
Instance Thread Procedure : Data = 'Instance'