Interview Questions

How do you create thread in.NET?

.NET Database ,COM interop,and .NET deployment questions and answers


(Continued from previous question...)

How do you create thread in.NET?

1) Import System.Threading
2) Create a new thread using new Thread() and assign the address of the method
3) Use Thread.Start method to start the execution

using System;
using System.Threading;

public class Test
{
static void Main()
{
ThreadStart job = new ThreadStart(ThreadJob);
Thread thread = new Thread(job);
thread.Start();

for (int i=0; i

(Continued on next question...)

Other Interview Questions