Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How do you escape c#?

895


What is namespace explain with example?

863


Which is better python or c#?

873


What is difference between internal and protected internal in c#?

945


what is difference between destruct or and garbage collection ?

946


What is wrong with the sample program below?

993


What is the function of the not null constraint?

950


Is class reference type c#?

919


What is a interface in c#?

1013


What are the Features in .net framework 1.1

995


explain the three services model commonly know as a three-tier application.

991


How do I edit a dll file?

890


Why do I get a "cs5001: does not have an entry point defined" error when compiling?

997


Differentiate between static class and singleton instance?

1023


Can mvc be used for desktop applications?

965