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

What is managed code execution?

0 Answers  


Write an StoredProcedure to get the values of a column within a date range.

1 Answers   Deloitte,


Difference between value type & reference types ?

0 Answers  


What is IIS and how we deploy website on IIS.

2 Answers   NetLink,


Can u explain me What is encapsulation?

7 Answers   Deloitte, GK companies,






what is the difference between class and structures?

2 Answers  


Explain the difference between constants and read-only variables?

0 Answers  


What is a delegate, How many types of delegates?

4 Answers  


WHAT IS .net

3 Answers  


What is assembly in .net?

0 Answers  


. How .NET can support multiple languages?

1 Answers  


.What is Marshaling?

2 Answers  


Categories