<p>I find that the .NET event model is such that I'll often be raising an event on one thread and listening for it on another thread.  I was wondering what the cleanest way to marshal an event from a background thread onto my UI thread is.</p>

<p>Based on the community suggestions, I've used this:</p>

<pre><code>// earlier in the code
mCoolObject.CoolEvent+= 
           new CoolObjectEventHandler(mCoolObject_CoolEvent);
// then
private void mCoolObject_CoolEvent(object sender, CoolObjectEventArgs args)
{
    if (InvokeRequired)
    {
        CoolObjectEventHandler cb =
            new CoolObjectEventHandler(
                mCoolObject_CoolEvent);
        Invoke(cb, new object[] { sender, args });
        return;
    }
    // do the dirty work of my method here
}
</code></pre>

I shun redundant delegate declarations.
```
```
private void mCoolObject_CoolEvent(object sender, CoolObjectEventArgs args)
{
    if (InvokeRequired)
    {
        Invoke(new Action<object, CoolObjectEventArgs>(mCoolObject_CoolEvent), sender, args);
        return;
    }
    // do the dirty work of my method here
}
```
```
For non-events, you can use the
```
System.Windows.Forms.MethodInvoker
```
delegate or
```
System.Action
```
.
EDIT: Additionally, every event has a corresponding
```
EventHandler
```
delegate so there's no need at all to redeclare one.