multithreading - C#, invoke anonymous method (Action<>) from background thread -


this should simple!

i want create anonymous action<> delegate perform gui update, call several other anonymous delegates (which run on separate threads).

    void test() {          action<string> invokedisplay = new action<string>(delegate(string element) {             //do variety of things gui depending on element parameter         });           methodinvoker oplong1 = new methodinvoker(delegate() {          //  long task              this.invoke(invokedisplay("long1"));         });          methodinvoker oplong2 = new methodinvoker(delegate() {          //  long task              this.invoke(invokedisplay("long2"));         });          new thread(new threadstart(oplong1)).start();         new thread(new threadstart(oplong2)).start();     } 

so whats correct syntax line?

            this.invoke(invokedisplay("long1")); 

the syntax be:

invoke(action, "long1"); 

the delegate first parameter, , argument(s) want pass follow.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -