I'm pretty new to F# so I'm not quite sure what I'm doing wrong here here's what I'm trying to do:
type MyClass() =
let someVar = this.MyMember()
member this.MyMember() :unit =
// insert some code here
I can't do that because Visual Studio tells me that "this" isn't defined so what should I do? am I missing some obvious feature of F# or something?
I tried making all my members functions instead... but then I'd have to re-order all the functions so they become visible and then it still wouldn't work
so what do?
You need to insert a self-identifier. This is not done by default for some performance reasons.
The following works:
type MyClass() as this =
let someVar = this.MyMember()
member this.MyMember() :unit = ()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With