正如標題所說,那麼我想訪問x。從一個讓,而不是一個成員。F# - >訪問x。從一個出發
以下工作:
type UploadController() =
inherit Controller()
member x.UploadPath
with get() = x.Server.MapPath "~/Uploads"
但這:
type UploadController() =
inherit Controller()
let uploadPath = x.Server.MapPath "~/Uploads"
拋出一個編譯器錯誤:
The namespace or module 'x' is not defined
不可能的任務?
這個問題可能會更好,標題爲「我怎麼從類構造函數中訪問this'?」 – Brian 2011-04-10 17:13:20