I need to interop with some C# code with F#. Null is a possible value that it is given so I need to check if the value was null. The docs suggest using pattern matching as such:
match value with
| null -> ...
| _ -> ...
The problem I’m having is the original code is structured in C# as:
if ( value != null ) {
...
}
How do I do the equivalent in F#? Is there a no-op for pattern matching? Is there a way to check for null with an if statement?
If you don’t want to do anything in the null case, then you can use the unit value
():Of course, you could also do the null check just like in C#, which is probably clearer in this case: