How do you create threading in .NET? What is the namespace
for that?

Answers were Sorted based on User's Feedback



How do you create threading in .NET? What is the namespace for that?..

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

How do you create threading in .NET? What is the namespace for that?..

Answer / guest

System.Threading.Thread

Is This Answer Correct ?    9 Yes 5 No

Post New Answer

More Dot Net General Interview Questions

How to implement datagrid in.net? How would you make a combo-box appear in one column of a datagrid? What are the ways to show data grid inside a data grid for a master details type of tables? If we write any code for datagrid methods. What is the access specifier used for that methods in the code behind file and why?

0 Answers  


Tell us what is the native image generator?

0 Answers  


What is func in .net 3.5?

0 Answers  


Explain the difference between static page and dynamic page?

0 Answers  


Please tell us what is the difference between override and overload in a method?

0 Answers  






Explain what is an application domain?

0 Answers  


What is difference between .net and .net core?

0 Answers  


Describe ways of cleaning up objects.

2 Answers   Wipro,


What is .net latest version?

0 Answers  


What is the difference between asp.net and asp?

0 Answers  


What is the difference between override and overload in a method?

0 Answers  


What is a variable of implicit type and what is its scope?

0 Answers  


Categories