8

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

4

1 に答える 1

17

バインディングを使用しstatic letます (注: 必要な場合もありますが、あまり機能的ではありません)。

type StaticMemberTest () =

    static let mutable test : string = ""

    member this.Test 

        with get() = 
            test <- "asdf"
            test
于 2008-09-15T17:56:56.290 に答える