-
Hi, How can we implement this function?
Maybe it's possible using Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Let's consider the simple case of static Option<Task<T>> Sequence<T>(this Task<Option<T>> task)
=> ??? : Some(???) : None; The challenge is filling in the blanks ( The other way around (synchronous -> asynchronous) is trivial. static async Task<Option<T>> Sequence(this Option<Task<T>> option)
=> option.Case switch
{
T t => Some((await t).ConfigureAwait(false)),
_ => None,
}; |
Beta Was this translation helpful? Give feedback.
-
You can use the built-in methods:
|
Beta Was this translation helpful? Give feedback.
You can use the built-in methods: