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

How do you turn off cookies for one page in your site? Give an example.

0 Answers  


What makes .net core cross platform?

0 Answers  


What are the main components in .net?

0 Answers  


What are the contents of assembly?

4 Answers   ABC, Ksb,


What are virtual destructures?

0 Answers  






create a keypair?

1 Answers  


Differentiate between 'DataSet' and 'SQLDataReader' in ADO.NET?

0 Answers   QuestPond,


What is a resource? Provide an example from your recent project.

1 Answers   Wipro,


Please explain what do the terms “boxing” and “unboxing” mean?

0 Answers  


What is MSIL, IL, CTS?

3 Answers  


How can I find out what the garbage collector is doing?

0 Answers  


Please explain what is heap and what is stack?

0 Answers  


Categories