What is the correct way to call DateTime.TryParse from F#?

Chris’s answer is correct if you really need to pass a mutable DateTime by reference. However, it is much more idiomatic in F# to use the compiler’s ability to treat trailing out parameters as tupled return values:

let couldParse, parsedDate = System.DateTime.TryParse("11/27/2012")

Here, the first value is the bool return value, while the second is the assigned out parameter.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)