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 the use of UML in .Net
What versions of .net are there?
What is a serviced component?
Explain manifest & metadata.
Is .net core free?
Explain me what is an anonymous method and how is it different from a lambda expression?
When we use windows api in .net is it managed or unmanaged code?
Can "this" be used within a static method?
What are the benefits of Model-View-Controller Architecture?
What is the use of Treeview control?
you have a requirement from client, he has an XML file and you need to insert the data into 5-6 tables in database. explain me the procedure.
What are the features of UIP Application Block?