How to define and use static variables in F# class
-
09-06-2019 - |
Question
Is there a way to have a mutable static variable in F# class that is identical to a static variable in C# class ?
Solution
You use static let
bindings (note: while necessary some times, it's none too functional):
type StaticMemberTest () =
static let mutable test : string = ""
member this.Test
with get() =
test <- "asdf"
test
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow