Domanda

Esiste un modo per avere una variabile statica mutabile nella classe F# che sia identica a una variabile statica nella classe C#?

È stato utile?

Soluzione

Usate static let rilegature (nota:anche se a volte è necessario, non è molto funzionale):

type StaticMemberTest () =

    static let mutable test : string = ""

    member this.Test 

        with get() = 
            test <- "asdf"
            test
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top