Write the sample code for threading in c# .net..
Answer Posted / alcheringa
using system.threading;
// this is the function that we want to invoke in a new
thread
static void doit()
{
for (int i=0 ; i < 10; i++)
{
console.writeline("doing somethin");
}
}
// this is the main fucntion
public static void main()
{
// threadstart is the delegate
// we need to pass the method, ts accept's method name as
the parameter
threadstart ts=new threadstart(doit);
// this is how we define a new thread
thread tr=new thread(ts);
// we invoke the thread
tr.start()
conosle.readline();
}
| Is This Answer Correct ? | 22 Yes | 10 No |
Post New Answer View All Answers
What is helper method in c#?
What is uint64?
What are the Types of configuration files and their differences
What is native image generator (ngen.exe)?
Is a structure a class?
What is difference between array and list in c#?
Explain about Threading Types.
What is lock statement in C#?
What is list collection in c#?
What is array collection?
What is autopostback in c#?
Illustrate serialization?
Is it possible to inherit multiple interfaces?
Is stringbuilder thread safe c#?
When was c# created?