Alex Rivera | Logout

Difference between BeginInvoke and Thread.Start

Asked 2009-08-04T09:17:27.637
21

I have a dialog based application in which I will delegating the I/O operation read write to different thread.

I just want to clear is there any difference between two approaches..

First approach: ( I am doing this in ,my main form -Form.cs)

delegate void Action();
Action _action = new Action(Method);
this.BeginInvoke(_action);

Second approach:

Thread th = new  Thread( new ThreadStart(_action));
th.Start();

I noticed that BeginInvoke hangs the UI for a second while second approach don't ..

Please help

Edit
Report

1 Answer

0

the difference would be that the BeginInvoke method simply calls the delegate asynchronously on the SAME thread.

Using the Thread.Start, you'll be creating an entirely different thread.

Thread.Start will definately give you better performance!

answered 2009-08-04T09:28:28.847

Your Answer