Advantage of using thread start

Posted by krrishbiju-15589 under C# on 5/21/2014 | Points: 10 | Views : 443 | Status : [Member] | Replies : 1
Hi,
For threading what is the difference between these

1.With using Threadstart

Thread thread = new Thread(new ThreadStart(WorkThreadFunction));
thread.Start();

public void WorkThreadFunction()
{
try
{
// do any background work
}
catch (Exception ex)
{
// log errors
}
}

2. With out using Threadstart
Thread thread = new Thread(WorkThreadFunction);
thread.Start();

public void WorkThreadFunction()
{
try
{
// do any background work
}
catch (Exception ex)
{
// log errors
}
}

regards
krrish




Responses

Posted by: Vuyiswamb on: 7/7/2014 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
i used Threads once , i think it was in a Windows Service when i want a certain line of code to run on certain intervals after than i never used threads. If they are used incorrectly they can cause a problem that will be difficult to point out. Try by all means to avoid Threads

Thank you for posting at Dotnetfunda
[Administrator]

krrishbiju-15589, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response