Why AsMaybe for structs has ref
?
#575
marcinjahn
started this conversation in
General
Replies: 1 comment
-
I guess we can get rid of |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Have a look at https://github.com/vkhorikov/CSharpFunctionalExtensions/blob/master/CSharpFunctionalExtensions/Maybe/Extensions/AsMaybe.cs#L16.
I guess the
ref
is there to avoid copying of the argument. However, it makes it difficult to use the extensions with properties.Example:
the workaround is to assign to some variable first:
Is there some way to make the experience a bit better?
Beta Was this translation helpful? Give feedback.
All reactions