What is the correct way to call DateTime.TryParse from F#? I am trying to test some code from F# interactive and I can’t figure out how to pass a mutable DateTime into the second argument by ref. What is the in/out/ref syntax in F#?
This is the method signature I’m looking at:
http://msdn.microsoft.com/en-us/library/ch92fbc1.aspx?cs-save-lang=1&cs-lang=fsharp#code-snippet-1
Chris’s answer is correct if you really need to pass a mutable
DateTimeby reference. However, it is much more idiomatic in F# to use the compiler’s ability to treat trailingoutparameters as tupled return values:Here, the first value is the
boolreturn value, while the second is the assigned out parameter.