Quick way to call Invoke

Sep 26, 2008

The invoke method does not accept anonymous delegates, which makes the code below not compile

Invoke(delegate() { HelloTextbox.Text = "Hello World!"; });

However, the invoke method does accept MethodInvoker delegates, so you can cast an anonymous delegate to MethodInvoker like the code below

Invoke((MethodInvoker)delegate() { HelloTextbox.Text = "Hello World!"; });
Posted by admin | Categories: Uncategorized |

Share with others

No Responses so far | Have Your Say!

Leave a Feedback

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>