Threading in C# - Easier to write

Threading in C# - Easier to write
It’s a subsequent Code-Snippet of Article : Threading CSharo - A Step Ahead Series.

/* This Example is a part of different
* examples shown in Book:
* C#2005 Beginners: A Step Ahead
* Written by: Gaurav Arora
* Reach at : */
// File name : threading.cs
using System;
using System.Threading;
namespace CSharp.AStepAhead.threading
class threading
public threading()
//Thread th = new Thread(new ThreadStart(writeData("Gaurav")));
public static string nm;
public static int i;
protected static void writeData()
//string str;
for (i=0; i<=nm.Length-1; i++)
Console.ForegroundColor = ConsoleColor.Blue;
Console.WriteLine(" {0}", nm.Substring(i, 1));

static void Main()
string name,lname;
Console.Write("Enter First Name : ");
name = Console.ReadLine();
Console.Write("Enter Last Name : ");
lname = Console.ReadLine();
threading.nm = lname;
Thread th = new Thread(new ThreadStart(writeData));
for (int j = 0; j <= name.Length - 1; j++)
Console.ForegroundColor = ConsoleColor.Green;
Console.Write(" {0}",name.Substring(j,1));

Article by Gaurav Aroraa
Gaurav is a Microsoft Technology Specialist professional. He has awarded lifetime membership from Computer Society of India (CSI). He has more than 13yrs of experience in the industry. Currently, he is working in the capacity of Solution Architect with an MNC. He is serving to the various communities since 1999.

Follow Gaurav Aroraa or read 157 articles authored by Gaurav Aroraa


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: