Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • 3
    The GC can tell when things are abandoned if no reference exists to them. If BeginInvoke returns a wrapper object which holds a reference to, but is not referenced by, the object that holds the real result data, the wrapper object would become eligible for finalization once all references to it were abandoned. Commented Oct 23, 2012 at 20:35
  • I question saying this is "not a good approach"; test it, with the error conditions you are concerned about, and see if you have problems. Even if garbage collection is not perfect, it will probably not affect most applications noticeably. Per Microsoft, "You can call EndInvoke to retrieve the return value from the delegate, if neccesary, but this is not required. EndInvoke will block until the return value can be retrieved." from: msdn.microsoft.com/en-us/library/0b1bf3y3(v=vs.90).aspx Commented Mar 27, 2015 at 20:58