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 |
Different between .net & j2ee ?
Please explain what is the difference between encrypting a password and applying a hashing?
What is boxing and un-boxing in .net?
What is the intermediate language between asp and asp.net1.0?
Describe session handling in a webform, how does it work and what are the limitations?
What is the difference between a Hash Table and a Dictionary?
Tell us what is json data, and what is one way that .net developers can work with json?
Explain me what is the .net framework and how does it work?
Why inheritance is important?
Differences between datagrid, datalist and repeater in .net?
Define code access security (cas)?
Who is using .net core?