How do you create threading in .NET? What is the namespace
for that?
Answer Posted / ashish omar
The namespace to use multithreading in .Net is "using
System.Threading;"
Live Example to demonstrate how multithreading can be
achieved in .Net.
C#
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
namespace DataAccess
{
class Thread_Excesise
{
public void Child_Thread()
{
for (int i = 0; i < 10; ++i)
{
Console.WriteLine(" Child_Thread with
Count" + i);
Thread.Sleep(100);
}
}
static void Main(string[] args)
{
Thread_Excesise inst = new Thread_Excesise();
for (int i = 0; i < 10; ++i)
{
Console.WriteLine("Main Thread");
Thread t = new Thread(inst.Child_Thread);
t.Start();
Thread.Sleep(1000);
}
}
}
}
Code posted by "Ashish Omar"
Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is the difference between odbc and ado?
How anonymous method is different from a lambda expression?
What is singlecall activation mode used for in .net?
What is assembly in .net?
can any one tel me the complete Testing Procedure of any one simple PROJECT i mean either web/windows based application?
Can a try block have more than one catch block?
What is close method? How its different from finalize and dispose?
Different levels of priority provided by .net.
What is the difference between .net 2000 and .net 2005(features)? Which one is better?
What is Flyout Design Pattern in .NET?
Tell us what is heap and what is stack?
How we can achieve Connection pooling in .Net?
Explain what are the deferred execution and the immediate execution in linq?
What is loosely coupled solution in.net?
What is .net standard?