What is threading in c# with example?



What is threading in c# with example?..

Answer / Sunanda Biswas

Threading in C# can be achieved by using the System.Threading namespace, which provides various classes like Thread and Task for creating and managing threads. Here's an example of a simple thread:
```csharp
using System;
using System.Threading;
class Program
{
static void Main(string[] args)
{
Thread myThread = new Thread(() =>
{
Console.WriteLine("Hello from a thread!");
});
myThread.Start();
Console.ReadLine();
}
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Sharp Interview Questions

Is goto statement supported in C#? How about Java?

2 Answers  


what is collections and what is generics

4 Answers   Bally Technologies,


What are the ways in which client can create object on server in cao model?

1 Answers  


what is IDisposal interface

1 Answers   Wipro,


Why is it important to override gethashcode when equals method is overridden?

1 Answers  


What do you use c# for?

1 Answers  


What is icomparable in c#?

1 Answers  


How many digits is a 32 bit number?

1 Answers  


How many types of constructor are there in c#?

1 Answers  


What is the purpose of a console table?

1 Answers  


What are different types of classes in c#?

1 Answers  


What is xml comments in c#?

1 Answers  


Categories