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

What does static mean in c sharp?

1055


What is difference between continue and break in c#?

958


What is the default value of boolean variable?

970


Can a dictionary have duplicate keys c#?

911


Which one is trusted and which one is untrusted?

929


Which controls do not have events?

1025


what is the difference between a struct and a class in c#?

1142


Can we call server-side code (c# or vb.net code) from javascript?

933


What is the difference between “out” and “ref” parameters in c#?

993


If a method's return type is void, can you use a return keyword in the method?

884


What is binding in c#?

902


What is the process of delegation?

966


Is string mutable in c#?

862


What are the value types in c#?

946


When should I use static in C#?

971