Action<SPItemEventProperties> deleteAction = DeleteWorkspace;
AsyncCallback deleteDone = deleteAction.EndInvoke;
SPSecurity.RunWithElevatedPrivileges(() => deleteAction.BeginInvoke(properties, deleteDone, null));
So this is suppose to call DeleteWorkspace Asynchronously and then call EndInvoke when its done, I wrote it but I am not positive it will work properly. I stepped through and it appears to work but the syntax is making me second guess myself cause I have never seen it done like this on the net…
Comments?
It should work, but to really understand it let’s pretend it were written like this:
Note that in the code above, it looks like the ‘Done’ callback will go out of scope right away. However, the compiler will capture (close over) it with a closure, so that it’s available when needed.