Press CTRL+C or CMD+C to copy the selected text and close this dialog.
Tweet
5 people like it. Like the snippet!
Wrap TryParse in an option.
1: 2: 3: 4: 5: 6:
let inline tryParse< ^T when ^T : (static member TryParse : string * byref< ^T > -> bool) and ^T : (new : unit -> ^T) > valueToParse = let mutable output = new ^T() let parsed = ( ^T : (static member TryParse : string * byref< ^T > -> bool ) (valueToParse, &output) ) match parsed with | true -> output |> Some | _ -> None