So I have a Parent object that has a sequence of child objects. Each of these child objects contains a 'date' property. I want to find out which of these objects has the earliest 'date' property. This is the code I've tried, but it doesn't compile - giving me a parenthesis error
let Parent = new ParentClass()
let seq = Parent.ChildClass |> Seq.minBy(_.Date)
I'm certain this is either a typo or me misunderstanding how Seq.minby is too be used. Unfortunately I have only been able to find examples of simple sequences - none that use child properties.
You need to use a lambda expression for this
let seq = Parent.ChildClass |> Seq.minBy(fun x -> x.Date)