Sunday, 3 December 2017

C# Program to Create a Simple Thread


Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
class program
{
    public void WorkThreadFunction()
    {
        for (int i = 0; i < 5; i++)
        {
            Console.WriteLine("Simple Thread");
        }
    }
}
class threprog
{
    public static void Main()
    {
        program pg = new program();
        Thread thread = new Thread(new ThreadStart(pg.WorkThreadFunction));
        thread.Start();
        Console.Read();
    }
}


Output:

Simple Thread
Simple Thread
Simple Thread
Simple Thread
Simple Thread


More C# Programs:


















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...