I'm trying to use two asynchronous methods in one method.
the methods look like this:
public static void sendMessage(Int32 uniqueRequestID, Int32 requestCode
class Receiver : IReceiver
public override void onAnswerReceive(Int32 uniqueRequestID, Answer answer)
and I'm trying to have this:
Data getData(Int32 code)
Int32 id = this.CreateNewUniqueID();
return new Data(answerIGotSomehowFromReceiverOnAnswerReceive);
also Receiver.onAnswerReceive is going to be called for a lot of answers , the link between the request and the answer is the Int32 uniqueRequestID.
So I have two problems :
1. how do I do to wait for the answer?
2. how to access the Answer from getData method in C# 4.0 ?
(I saw some articles about async/wait but as I understand it's for the next release of .NET so not usable)?
It must be a pretty common problem but I'm not sure what to look for?
One idea was to add a Dictionary<Int32, Answer> in the Receiver class, but if there are some .NET tools designed for this I would rather use them...
Any idea, link, or even code sample more than welcome.
Thanks in advance,