2
"Automatically implemented properties are part of the initialization of a type, so they must be included before any other member definitions, just like let bindings and do bindings in a type definition"初始化在F#
自動實現的屬性但是,如果我以後在類型聲明中的其他普通member this.
性質把member val
的編譯器不抱怨。沒關係?
我正確地說,初始化一個對象時,而不是當屬性第一次被調用時,該屬性被初始化?
例如
member val = let printf "%A" "initializing"
3 with get, set
所以每次我創建一個對象,它會打印出「初始化時間?
你嘗試運行呢? –