Last active
August 29, 2015 14:04
-
-
Save tomorgan/4735f4373b6cb66e15c5 to your computer and use it in GitHub Desktop.
Async Begin..End example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void MyMethod() { | |
//do some stuff | |
var flow = GetFlowFromSomewhere(); | |
var message = GetMessageFromSomewhere(); | |
flow.BeginSendInstantMessage(message, EndBeginSendInstanceMessage, flow); | |
//do some other things.... | |
} | |
private static void EndBeginSendInstantMessage(IAsyncResult ar) | |
{ | |
try | |
{ | |
InstantMessagingFlow flow = (InstantMessagingFlow)ar.AsyncState; | |
flow.EndSendInstantMessage(ar); | |
} | |
catch (Exception ex) | |
{ | |
//do something with this error | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment