Press CTRL+C or CMD+C to copy the selected text and close this dialog.
5 people like it.
Like the snippet!
Wrap TryParse in an option.
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
This web site is created using F# and Suave web server. It is hosted on
Azure and the source code is on GitHub. Contributions
The first version of fssnip.net has been created by
@tomaspetricek back in 2010.
This web site is a new, open-source and contribution-friendly version.