SocketAsyncCall GetDelegate (Worker worker, SocketOperation op)
{
switch (op) {
case SocketOperation.ReceiveGeneric:
goto case SocketOperation.Receive;
case SocketOperation.Receive:
return new SocketAsyncCall (worker.Receive);
case SocketOperation.ReceiveFrom:
return new SocketAsyncCall (worker.ReceiveFrom);
case SocketOperation.SendGeneric:
goto case SocketOperation.Send;
case SocketOperation.Send:
return new SocketAsyncCall (worker.Send);
case SocketOperation.SendTo:
return new SocketAsyncCall (worker.SendTo);
default:
return null; // never happens
}
}