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
What are virtual destructures?
Conceptually, what is the difference between early-binding and late-binding?
Explain how to load the contents of an xml file into an xmldocument object?
What is RPC? What is the use of it?
What is "microsoft intermediate language" (msil)?
Explain me why do we use msmq?
How we can achieve Connection pooling in .Net?
What is garbage collection? Explain the difference between garbage collections in .net 4.0 and earlier versions?
What are the challenging issues you have faced in implementation project/Maintainance project in .net Functionality? How you have overcome that issue?
Do you know what is lambda expressions in c#?
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 ?
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?
What is web.config in .net?
Explain what is an interface and what is an abstract class? Please, expand by examples of using both. Explain why?
What is meant by localization?