ElementAt

What if we want only the fifth element emitted by an Observable sequence? elementAt() function emits only the n element from a sequence, and then it completes.

What if we are looking for the fifth element but the Observable sequence only emitted three elements? We can use elementAtOrDefault(), of course. The next figure shows how to cherry-pick the third element from a sequence by applying elementAt(2) and creating a new Observable by emitting only this specific element:

ElementAt
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.61.81