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 Datatype Conversion in Vb.net?

1 Answers  


How to prepare parametrized (with more than one parameters) crystal report. Please tell me the code procedure, if any body can?

0 Answers  


What does il do?

0 Answers  


what is the default security setting in .net?

0 Answers  


Using com component in .net?

0 Answers  






What is dot net and its uses?

0 Answers  


Explain the differences between server-side code and client-side code.

0 Answers  


Is there built-in support for logging?

0 Answers  


In Mvc Architecure what is view?

1 Answers   TCS,


What are the similarities and difference between class and structure in .net?

0 Answers  


Directcast(123.34,integer) - should it throw an error? Why or why not?

1 Answers   Wipro,


Please explain what is heap and what is stack?

0 Answers  


Categories