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 should you do to store an object in a viewstate?
Is .net front end or backend?
I was working for software company frm 2005 to 2009. I left job due to recession.I was jobless till dec 09 then i got job in bpo and i am not knowing what to do as my professional experience is with software.give me any suggestion.
What is the use of design pattern?
What is concurrency? How will you avoid concurrency when dealing with dataset?
What is a manifest in .net?
Tell me what is serialization?
Explain the garbage collection process?
What class does icon derive from? Isn't it just a bitmap with a wrapper name around it?
Explain how does assembly versioning work?
When displaying fonts, what is the difference between pixels, points and ems?
What are the types of jit?
Explain what inheritance is, and why it's important?
Tell us what is a variable of implicit type and what is its scope?
which methos do you invoke on the dataadapter control to load your generated dataset with data?