Question

I have a observable of "hot" payloads:

IObservable<Payload> Payloads;

I have a setup function where I now need to grab a payload, to see what data is being passed through, before continuing with the Setup.

Conceptually, what I want to do is this :

Payload payload = await Payloads.First()

i.e. at that line of code I want to wait until a payload is available and then carry on.

Can I do that with anything already in Reactive Extensions?

Était-ce utile?

La solution

You can do either:

await Payloads.Take(1);

or:

await Payloads.FirstAsync();
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top