Assertfail

All Posts assertfail

View the Blog on GitHub wallymathieu

FSharpx.Extras

23 Aug 2015

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.

Tags

  • f#
  • Comments or errors? Fork post and do a pull request on github