Question: Why does IEnumerable<T>.ToOption resolves to Option<T>? #1059
Replies: 2 comments
-
In this case, the exact functionality you're looking for is in |
Beta Was this translation helpful? Give feedback.
-
You´re absolutely right! I think it is time to set Thanks a lot, Laszlo |
Beta Was this translation helpful? Give feedback.
-
Hello,
why does
IEnumerable<T>.ToOption
transform toOption<T>
and not toOption<IEnumerable<T>>
?And, if the
IEnumerable<T>
is not null, the Head (first entry) gives back as result?I wrote myself a helper method that implement it more type-in, type-out.
From here, you can just resolve the option with IfNone....
e.g.
And res is
a) an empty IEnumerable (if null) or the filled one.
b) the incoming IEnumerable as Value if it is not null
Thanks and Regards,
Laszlo
Beta Was this translation helpful? Give feedback.
All reactions