Assertfail

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


Comments

Do you want to send a comment or give me a hint about any issues with a blog post: Open up an issue on GitHub.

Do you want to fix an error or add a comment published on the blog? You can do a fork of this post and do a pull request on github.