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 does jit compilation do in .net?
Explain what are the deferred execution and the immediate execution in linq?
object is physical and class is logical..here class is not occupying any memory as our definition of class but i got a question then the class where it stores if it is not occupying any memory....
What is JIT and how is works?
How do you give a Windows service specific permissions?
Explain difference between panel and groupbox classes using .net?
Please explain what is a delegate?
What is COM Interoperability in .NET
How to spawn a thread?
What are the difference bbetween value type & reference types ? Example from .net. Integer & struct are value types or reference types in .net?
Is atl redundant in the .net world?
Explain asp.net?