An asynchronous question:
I’ve been reading over the internet LOTS of articles for and against Delegate.EndInvoke() being optional. Most of those articles are 4-5 years old. Lots of dead links.
Can anyone explain, in .NET 2.0 – is EndInvoke() indeed preventing an otherwise-inevitable memory leak, and if yes can you please specify what causes this leak?
On the same subject: If EndInvoke() is indeed a must – I find the best way to implement Fire-and-forget mechanism using a callback method that runs EndInvoke(). I’d love to hear from anyone who thinks otherwise.
Thanks,
O
For
Delegate.EndInvoke, you should call it. ForControl.EndInvoke, the WinForms team has said that you don’t need to call it. I don’t know about the equivalent for WPF, but I think it’s a good idea to do so unless you’ve got a really good reason to believe you don’t have to.I have some “fire and forget” code for delegates in my threading article – about half way down (search for “fire”).