How do you create threading in .NET? What is the namespace
for that?
Answers were Sorted based on User's Feedback
Answer / 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 |
What is UDDI and how to register a web service ?
What is Full trust permission set in .Net
If we write any code for DataGrid methods, what is the access specifier used for that methods in the code behind file and why?
What is msil, il?
Explain what is heap and what is stack?
What's wrong with a line like this? Datetime.parse(mystring);
Do you know what is garbage collector?
How can you automatically generate interface for the remotable object in .NET with Microsoft tools?
What are the new features of Framework 1.1 ?
What is 3 tier architecture?
How do you create threading in .NET? What is the namespace for that?
What is func in .net 3.5?