Action T synchronous and asynchronous
Posted
by raffaeu
on Stack Overflow
See other posts from Stack Overflow
or by raffaeu
Published on 2010-03-12T16:36:09Z
Indexed on
2010/03/12
17:07 UTC
Read the original article
Hit count: 205
asynchronous-processing
|c#
Hi everybody I have a contextmenustrip control that allows you to execute an action is two different flawours. Sync and Async. I am trying to covert everything using Generics so I did this:
public class BaseContextMenu<T> : IContextMenu
{
private T executor
...
public void Exec(Action<T> action){
action.Invoke(this.executor);
}
public void ExecAsync(Action<T> asyncAction){
...
}
How I can write the async method in order to execute the generic action and 'do something' with the menu in the meanwhile? I saw that the signature of BeginInvoke is something like:
asyncAction.BeginInvoke(thi.executor, IAsyncCallback, object);
© Stack Overflow or respective owner