Define a static property for F# class

it's quite easy to define a modifiable static property in C# , but in F#,a defined static filed is required  first when the class want to define a static property.

  

type StacitMemberCls() = 
    //A static filed should be defined first
    static let mutable staticFiled = ""  
      
    static member StaticProp
        with get() = staticFiled
        and set(v) = staticFiled <- v

 

posted @ 2012-11-07 14:33  ZackZhou  阅读(183)  评论(0编辑  收藏  举报