Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should TryGetValue exist for Options and Results #134

Open
JohannesMoersch opened this issue Apr 3, 2023 · 1 comment
Open

Should TryGetValue exist for Options and Results #134

JohannesMoersch opened this issue Apr 3, 2023 · 1 comment

Comments

@JohannesMoersch
Copy link
Owner

Should bool TryGetValue(out TValue) and bool TryGetValue(out TSuccess, out TFailure) exist? They are already implemented internally to support the writing of zero allocation extensions.

These would be a useful escape hatch for those scenarios where you really do need to switch to an imperative pattern (although these are hopefully rare). Would they encourage bad practices? I'm not sure which way I lean on this. @RyanMarcotte @deimors @NathanMagnus Any thoughts?

@deimors
Copy link
Collaborator

deimors commented Apr 3, 2023

I'm not against it, the call pattern still clearly communicates the possibility of None or Failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants