c#,passing,pass,parameter,for,thread

Patrick64 8/15/2016 1people says helpful

This Code Shows How to Illustrate the Concept of Passing Parameter for Thread

C#
 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);
    }
} 

/*
Here is the output of the C# Program: Static Thread Procedure : Data = '20' Instance Thread Procedure : Data = 'Instance'

*/

Report Bug

Please Login to Report Bug

Reported Bugs

Comments

Please Login to Comment

Comments