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 |
Do you know what is the difference between an abstract class and an interface?
What is the use com component in .net?
What is the lapsed listener problem?
How you apply a theme in whole application in .Net?
What is a formatter in .net?
Do you know what is .net standard?
How viewstate is being formed and how it is stored on client in .net?
Define satelite assembly?
How can you automatically generate interface for the remotable object in .NET with Microsoft tools?
If we want to write a Windows service that cannot be paused, only started and stopped. How to accomplish that?
what is assembly?
Why DLL files are needed. & how They are Created in DOTNET?