我在现有模块上声明名称空间时收到错误消息。为什么在通过模块添加名称空间时收到错误?
错误:
Unexpected start of structured construct in definition. Expected '=' or other token.
注意,我只是将一个命名空间:
namespace ManageModules
没有命名空间,代码编译。
代码:
namespace ManageModules
module CreateModule.UILogic
open System.Windows.Input // Error is referenced here...
open UILogic.State
open UILogic.Interaction
open ManageModule.Entities
open System.Collections.ObjectModel
type CreationViewModel() =
inherit ViewModelBase()
let mutable (_modules:Module ObservableCollection) = ObservableCollection()
member this.Modules
with get() = _modules
and set(value) = _modules <- value
member this.Add moduleItem =
_modules.Add(moduleItem)
很高兴你自己想通了。在你的回答中,你没有说出为什么'='起作用。有时甚至直到今天,命名空间/模块的东西仍然会抛出我。花几个小时来更好地理解原因,否则这个问题将在未来花费更多的时间,比现在几个小时更多地了解它更详细。换句话说,你现在可以付出一点时间,或者一次又一次地付出时间,而后者会花更多的时间。 –
请参阅:[组织功能](http://fsharpforfunandprofit.com/posts/organizing-functions/)和[组织项目中的模块](http://fsharpforfunandprofit.com/posts/recipe-part3/) –
是的。这就是我发现解决方案时所引用的内容。谢谢。 –