Pergunta

Existe uma maneira de ter uma variável estática mutável na classe F# que seja idêntica a uma variável estática na classe C#?

Foi útil?

Solução

Você usa static let ligações (nota:embora necessário algumas vezes, não é muito funcional):

type StaticMemberTest () =

    static let mutable test : string = ""

    member this.Test 

        with get() = 
            test <- "asdf"
            test
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top