I’m trying to create a class with a list of int as member variable. However, it is not working as expected. See this example:
type Class() =
member this.x = List()
member this.y = 1
let c = Class() printfn "%d" c.y c.x.Add(1) printfn "%d" c.x.
This is printing 1 and then throws ArgumentOutOfRangeException because the list is empty.
Would be grateful for an explanation