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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are virtual destructures?

611


Conceptually, what is the difference between early-binding and late-binding?

680


Explain how to load the contents of an xml file into an xmldocument object?

643


What is RPC? What is the use of it?

692


What is "microsoft intermediate language" (msil)?

631






Explain me why do we use msmq?

652


How we can achieve Connection pooling in .Net?

734


What is garbage collection? Explain the difference between garbage collections in .net 4.0 and earlier versions?

778


What are the challenging issues you have faced in implementation project/Maintainance project in .net Functionality? How you have overcome that issue?

4685


Do you know what is lambda expressions in c#?

643


I have a problem in installing visual Studio 2008 on PC that have Celeron Processor ? afterAll InstallionFaied . Pls suggest me . Is it possible or not .if Yes then How ?

1654


A developer company sends dlls to the client. Some client is not happy current functionality, so request some modification. Developer made some changes and send new dll to all clients. Some client is happy with old version, tell me minimal change to so that neither clients get affected?

595


What is web.config in .net?

671


Explain what is an interface and what is an abstract class? Please, expand by examples of using both. Explain why?

622


What is meant by localization?

705