Add deconstruct to Option/Maybe to support eg (hasValue, value) = collection.TryFirst(...)
See original GitHub issueBased on a suggestion from @pkanavos:
- Add a deconstruct to
Option<T>
(andMaybe<T>
if it doesn’t just work through implicit casting):
public void Deconstruct<T>(out bool hasValue, out T value) => ...
- Look at possibly adding similar deconstructs to
Success<T>
,Either<T1, T2>
and union types.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
How to null check c# 7 tuple in LINQ query?
The method is called FirstOrDefault , not TryFirst . It's not meant to check whether a value exists or not, although we all...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Option<T>.ValueOrDefault
seems legit.Added to v3.1