VB.NET 2010, .NET 4
This might be a dumb question but I’m wondering what is special about the SendOrPostCallback delegate that is the first argument in WindowsFormsSynchronizationContext‘s Send and Post methods? In other words, I can do the following:
SyncContext.Send(Sub() ..some work.., Nothing)
And that works (SyncContext is a WindowsFormsSynchronizationContext object). Why might it be preferable to do:
Dim blah As Threading.SendOrPostCallback = Sub() ..some work..
SyncContext.Send(blah, Nothing)
?
Update: Acknowledging Hans’ answer, I update the question: If there is no difference, why is SendOrPostCallback defined? Is there something special about it or is it just an alias? Perhaps I’m just not getting something more fundamental.
Nothing, it is just a delegate like any other. There’s no logical difference between the snippets, the JIT compiler generates the same code. Pick the style you prefer.