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

ctype(123.34,integer) - should it throw an error? Why or why not?

1 Answers   Wipro,


Name for built-in permission sets in .Net

1 Answers  


Which among the following two is best and why? Abstract Class and Interface. What is the major difference in between those two except the discrete methods and methods with function definition.

4 Answers   247Customer,


Explain about Behavioral design pattern?

0 Answers  


How does linq work?

0 Answers  






which method do you use to redirect the user to another page without performing a round trip to the client? How?

0 Answers  


Different between .net & j2ee ?

0 Answers  


How inheritance works in .net?

0 Answers  


i have 2 functions, int add(int a,int b); double add(int a,int b); does this code implement overloading? if not what will be the error?

4 Answers   Deloitte,


What is a system lock?

2 Answers   Wipro,


which is the best dot net coaching center in visakhapatnam??

3 Answers  


What is the difference between odbc and ado?

0 Answers  


Categories