Write the sample code for threading in c# .net..
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / gby
question to Alcheringa?
So why did you define int i? ????
Is This Answer Correct ? | 8 Yes | 5 No |
Answer / sivakumar v
Static Void Run()
{
Console.WriteLine("Thread Is Running");
}
static void Main()
{
Thread TrdObj=new Thread(Run);//create the obj
TrdObj.start();
}
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / maryada ramana
first uhave to learn c#.net then u will undertsand how much
diff is .net useless fellow Alcheringa a prentra alcherenga
kampalo putinaava
Is This Answer Correct ? | 3 Yes | 4 No |
What is the difference between class and abstract class?
How many kinds of elements an array can have?
Is array immutable in c#?
How to implement delegates in c#.net
What is desktop example?
Difference between multi-level and multiple inheritance?
What framework is used for performance testing/load testing?
Is string mutable in c#?
What is dependency injection?
What are custom exceptions?
Can you allow class to be inherited, but prevent the method from being over-ridden?
How to parse a date time string?