The correct way to Fire-and-Forget an asynchronous delegate

Posted by Programming Hero on Stack Overflow See other posts from Stack Overflow or by Programming Hero
Published on 2010-04-13T14:48:21Z Indexed on 2010/04/13 14:52 UTC
Read the original article Hit count: 654

Filed under:
|
|

Consider me rusty on the subject of asynchronous delegates.

If I want to call a method asynchronously, in a fire-and-forget style, is this an appropriate way to do it?

Action action = DoSomething;
action.BeginInvoke(action.EndInvoke, null);

The DoSomething() method catches all exceptions and deals with them internally.

Is the call to EndInvoke appropriate? Required?

Is there a clearer way to achieve the same behaviour?

© Stack Overflow or respective owner

Related posts about c#

Related posts about asynchronous