You would create a class that has all of your "captured" variables as pass that along as state:
public class QueryState
{
public CloudTable CloudTable{get;set;}
public Token Token{get;set;}
public class ManualResetEvent Evt{get;set;} //i'm guessing that's what this is
//any other variables you were using
}
Then, you would create a delegate like this:
AsyncCallback asyncCallback = (asyncResult) =>
{
QueryState state = asyncResult.State as QueryState;
var response = state.CloudTable.EndExecuteQuerySegmented(asyncResult);
//rest of method... make sure to use the state variable to get whatever you need.
}
Finally, you call it like this:
var state = new QueryState
{
CloudTable = tableSymmetricKeys,
//set everything else
}
var result = tableSymmetricKeys.BeginExecuteQuerySegmented(query, token, opt, ctx,asyncCallback, state);