Reputation:
Is there a way to have a mutable static variable in F# class that is identical to a static variable in C# class ?
Upvotes: 9
Views: 5745
Reputation: 18712
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
Upvotes: 18