public int SendServiceCallFromAnotherClass()
{
client.SendCompleted += new EventHandler<SendCompletedEventArgs>(client_SendCompleted);
client.SendAsync(clientSettings);
//i have to return some int here from my service
}
void client_SendCompleted(object sender, SendCompletedEventArgs e)
{
//so here i have to return int variable from my SendServiceCallFromAnotherClass method
}
,
You can’t return a variable from the send completed callback because its signature is defined by the SendAsync
parameter delegate (EventHandler<SendCompletedEventArgs>
). What you can do is invoke some other method passing the result of the async operation result which you would find in the e
parameter.