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

Strilanc.Value.May<T>.Match() - Must never use null as second parameter #124

Open
jongleur1983 opened this issue Aug 13, 2018 · 0 comments

Comments

@jongleur1983
Copy link

the May type from the Strilang.Value package has two overloads for the Match() function.

  1. May<T>.Match<T, TOut>(Func<T, TOut> valueProjection, Func<TOut> alternativeFunc)
  2. May<T>.Match<T, TOut>(Func<T, TOut> valueProjection, TOut alternativeValue)

The first variant must not be called with alternativeFunc being null. The second may be called with null, but if written as plain code, using null here the compiler usually resolves it to the first variant, and by that failing at runtime.

Project on GitHub: https://github.com/Strilanc
Package in NuGet: https://www.nuget.org/packages/Strilanc.Value.May

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

1 participant