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
If a dataset contains 100 rows, how to fetch rows between 5 and 15 only?
How viewstate is being formed and how it is stored on client in .net?
Explain what is the difference between response.redirect & server.transfer?
Differences between dll and exe?
What is the native image generator?
What is the benefit of .net core?
Explain re-clarification of object based in .net?
What does jit compilation do in .net?
Can you create instance of a class which has private constructor?
i m fresher,hav SQL knowledge but in my ofc. i hav to work on dotnet. so plz tell me how to learn it,? from where to stat? i hav C prog. knowledge, ASP.net
What is the concept of inheritance and how it works in .net?
What is an anonymous method?
What is .net and .net framework?
Is .net front end or backend?
What is typical about a windows process in regards to memory allocation in dot net?