Simple example of Threading in C#

Here is the simple code for Threading class.


using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;

namespace ThreadingExample
{
class Program
{
static void Main(string[] args)
{
Console.Write("Enter the Number: ");
int num = int.Parse(Console.ReadLine());
for (int ctr = 1; ctr <= num; ctr++)
{
Console.WriteLine("Value of ctr is " + ctr);
Thread.Sleep(1000);
}
}
}
}


Comments

No responses found. Be the first to comment...


  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: