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
object is physical and class is logical..here class is not occupying any memory as our definition of class but i got a question then the class where it stores if it is not occupying any memory....
Explain about the features and elements present in Visual studio.NET IDE?
What are the new features of Framework 1.1 ?
How will you do redo and undo in textbox control?
Explain what are the deferred execution and the immediate execution in linq?
What is common type system (cts)?
what is the meaning silverligt control
What does stateless mean?
Explain can 2 different applications use the same dll in gac at the same time?
Explain me why do we use msmq?
Is .net front end or backend?
How do I spawn a thread?
What is assembly in .net?
Explain me what is the .net framework and how does it work?
Define satelite assembly?