ExternalAnnotations
ExternalAnnotations copied to clipboard
Strilanc.Value.May<T>.Match() - Must never use null as second parameter
the May<T> type from the Strilang.Value package has two overloads for the Match() function.
-
May<T>.Match<T, TOut>(Func<T, TOut> valueProjection, Func<TOut> alternativeFunc)
-
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