8

有没有办法让 F# 类中的可变静态变量与 C# 类中的静态变量相同?

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 回答