In my eternal desire to suck less, I try to understand the syntax of Rx.net FirstAsync(). Most of the documents are obsolete. First()If I understand correctly, this allows me to start the stream as soon as the first element from the stream appears.
FirstAsync()
First()
Let's say I have a thread myStream, and I want to start a thread that takes the first element and starts the thread based on this one element. In my case, it will be a stream of one.I expect him to do this:
myStream
--- 1-2->--- --->
How can i do this?
myStream.FirstAsync().Return(() => return "A"); // doesn't compile
, : .FirstAsync() a Task ( .Result). Task, IObservable<TSource>. , .
.FirstAsync()
Task
.Result
IObservable<TSource>
, : myStream.FirstAsync().Select(_ => "A").
myStream.FirstAsync().Select(_ => "A")
myStream.Take(1).Select(_ => "A"). FirstAsync , FirstAsync , myStream - . Take(1) .
myStream.Take(1).Select(_ => "A")
FirstAsync
Take(1)
" FirstAsync?":
IObservable<T>, :
IObservable<T>
( ), .
, , ( OnError), Catch Subscribe ..
Catch
Subscribe
, , FirstOrDefaultAsync
FirstOrDefaultAsync
Source: https://habr.com/ru/post/1678964/More articles:How to choose opponents for TurnBaseMatches after GMS 11.0.0? - androidRe-recursion in Javascript function too soon - javascriptLoop through array, assign each attribute an element attribute in Javascript / JQuery - javascriptESLint parsing error when using arrow syntax with asynchronous - eslintИмеет ли член shared_ptr разрыв контракта CopyConstructible? - c++Creating a Cartesian product for n different types - pythonGrouping and comparing groups with pandas - pythonJersey 2 - Simple Client Get with Headers Example - javaКак эффективно перестраивать проект, используя Docker Compose? - dockerUndefined namespace F # FS0039 - asp.netAll Articles