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 are the new features in .net core?
How to use datagrid value in select statements where condition ,if cell is hyperlink bounded column?
what all type of application can u make with visual studio?
What is an Interface? Have you ever developed an Interface.
Difference between Debugging and tracing in .net
What is the advantage of packaging over xcopy in .net?
What is meant by localization?
What is the difference between a namespace and assembly name in .net?
What are the core differences between .NET Languages ?
What is garbage collection in .net? Explain the garbage collection process?
What are pdbs?
Writing a Stored procedure to insert the values into a table