Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (13 sloc) 483 Bytes
layout title date tags
post
FSharpx.Extras
2015-08-23 20:44:46 +0200
f#

Turns out that there is a simpler way of dealing with optional values in c#.

Include FSharpx.Extras to your c# project and then you can do the following:

optionalValue.Match( 
    ifSome: value => ProcessValue(value),
    ifNone: () => NoValueToProcess()
);

Thanks to extension methods in this library. There are extension methods for other common discriminated unions as well.