Well ... you could do ...
type Test() =
member this.MyMethod (x:string) =
if try
foo()
bar()
true
with _ -> false
then
"blah"
else
null
Or, flip true / false ...
type Test() =
member this.MyMethod (x:string) =
if try
foo();
bar();
false
with _ -> true
then
null
else
"blah"
I highly recommend switching from zero to return the option type (Some (x) / None). Let the compiler catch places where null is not processed, not your users; -)
source
share