How to define and use static variables in class F #

Is there a way to have a mutable static variable in an F # class that is identical to a static variable in a C # class?

+6
functional-programming f #
source share
1 answer

You use static let bindings (note: if necessary several times, this is not too functional):

 type StaticMemberTest () = static let mutable test : string = "" member this.Test with get() = test <- "asdf" test 
+13
source share

All Articles