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 / sabu

using System;
using System.Threading;
namespace ConsoleApplication1
{
class Class1
{
static void PrintHelloFromThreadName()
{
Console.WriteLine("Hello, from thread {0}",
Thread.CurrentThread.Name); // {0}
}
public void ThreadStart()
{
PrintHelloFromThreadName();
}
static void Main(string[] args)
{
Thread.CurrentThread.Name = "Main thread";
Class1 obj = new Class1();
Thread thread = new Thread(
new ThreadStart(obj.ThreadStart));
thread.Name = "Forked thread";
thread.Start();
PrintHelloFromThreadName();
}

Is This Answer Correct ?    4 Yes 1 No

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

Answer / kinjal

for threading namespace in .NET is
using System.Treading

static void Main(string[] args)
{
Thread.currenttread.name="k";
Console.WriteLine("name is {0}" , Thread.currentthread.name)
}

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More Dot Net General Interview Questions

what user controls are and what server controls are and the differences between the two.

0 Answers  


what is the difference between early binding and late binding in .net?

2 Answers   Satyam,


what will do to avoid prior case?

0 Answers  


How to instantiate a delegate?

0 Answers  


What is SOAP? How you will do windows and forms authentication?

0 Answers   Wipro,






What is difference between system.string and system.stringbuilder classes?

0 Answers  


What are .net functions?

0 Answers  


How big is the datatype int in .net?

0 Answers  


What is DTS and explain the purpose of it?

0 Answers   ADITI,


What is the model role in Mvc architecture?

3 Answers  


How to find methods of a assembly file (not using ILDASM) Reflection

1 Answers  


Explain the top .net class that everything is derived from?

0 Answers  


Categories