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 Datatype Conversion in Vb.net?
How to prepare parametrized (with more than one parameters) crystal report. Please tell me the code procedure, if any body can?
What does il do?
what is the default security setting in .net?
Using com component in .net?
What is dot net and its uses?
Explain the differences between server-side code and client-side code.
Is there built-in support for logging?
In Mvc Architecure what is view?
What are the similarities and difference between class and structure in .net?
Directcast(123.34,integer) - should it throw an error? Why or why not?
Please explain what is heap and what is stack?