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
how to Create a datagridview control with check box column with 8rows in it, the maximum number of check boxes checked should be 3, when user checks the 4th corresponding message should be displayed and check box should be checked. User can uncheck the checked boxes Note: read-only property should not be used
How can I create a process that is running a supplied native executable (e.g., Cmd.exe)?
Can we store different data types in arraylist in c#?
What is difference between a type and class?
explain the three services model commonly know as a three-tier application.
How do you comment out code in c#?
How to use nullable types in .net?
Why is it called c sharp?
What is inheritance in csharp?
Why do we need delegates in c#?
What is delegates in c#?
What is default value of bool in c#?
What is remote data?
what happens if you inherit multiple interfaces and they have conflicting method names?
Explain about Oops concept