Can anyone tell me if I'm likely to run into unintended behavior if I use anonymous methods with Async I/O?
As an example:
Action<Socket> acceptedHandler = DoAccept
SocketAsyncEventArgs e = new SocketAsyncEventArgs();
e.Completed += ((sender, ea) => acceptedHandler(ea.AcceptSocket));
// Server is a Socket
if (!Server.AcceptAsync(e))
acceptedHandler(e);
The same applies to BeginXXX/EndXXX async I/O.