Types 为什么在模块上添加命名空间时会收到错误?
当我在现有模块上声明名称空间时,收到一个错误 错误:Types 为什么在模块上添加命名空间时会收到错误?,types,module,f#,namespaces,Types,Module,F#,Namespaces,当我在现有模块上声明名称空间时,收到一个错误 错误: 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.Colle
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)
namespace ManageModules
module CreateModule =
open System.Windows.Input
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)
定义中的结构化构造意外开始。应为“=”
或其他代币
注意,我只是添加了一个名称空间:
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)
namespace ManageModules
module CreateModule =
open System.Windows.Input
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)
如果没有名称空间,代码将编译
代码:
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)
namespace ManageModules
module CreateModule =
open System.Windows.Input
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)
名称空间管理模块
模块CreateModule.UILogic
open System.Windows.Input//此处引用了错误。。。
打开UILogic.State
开放式UILogic.交互
打开ManageModule.Entities
open System.Collections.ObjectModel
类型CreationViewModel()=
继承ViewModelBase()
设可变(_模块:模块ObservableCollection)=ObservableCollection()
成员:本模块
使用get()=\u模块
set(value)=\u modules看起来,当我在一个模块上提供名称空间时,我需要在我的模块声明中附加一个equal运算符
namespace ManageModules
module CreateModule =
代码:
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)
namespace ManageModules
module CreateModule =
open System.Windows.Input
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)
名称空间管理模块
模块创建模块=
打开System.Windows.Input
打开UILogic.State
开放式UILogic.交互
打开ManageModule.Entities
open System.Collections.ObjectModel
类型CreationViewModel()=
继承ViewModelBase()
设可变(_模块:模块ObservableCollection)=ObservableCollection()
成员:本模块
使用get()=\u模块
set(value)=\u modules看起来,当我在一个模块上提供名称空间时,我需要在我的模块声明中附加一个equal运算符
namespace ManageModules
module CreateModule =
代码:
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)
namespace ManageModules
module CreateModule =
open System.Windows.Input
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)
名称空间管理模块
模块创建模块=
打开System.Windows.Input
打开UILogic.State
开放式UILogic.交互
打开ManageModule.Entities
open System.Collections.ObjectModel
类型CreationViewModel()=
继承ViewModelBase()
设可变(_模块:模块ObservableCollection)=ObservableCollection()
成员:本模块
使用get()=\u模块
和set(value)=_modules有两种类型的模块声明:顶级模块声明和本地模块声明
顶级模块声明使用以下语法声明:
module [accessibility-modifier] [qualified-namespace.]module-name
本地模块声明是用
module [accessibility-modifier] module-name =
顶级模块声明必须作为文件中的第一条语句出现,然后模块包含该文件中的所有内容。相反,您可以有多个本地模块声明
请注意,虽然顶级声明还允许您选择性地添加
以提供限定的命名空间,但您不能在本地模块声明中使用
s,尽管您可以嵌套本地模块
在您的情况下,由于您的模块声明没有出现在文件的开头,因此必须编写:
namespace ManageModules
module CreateModule =
...
有关更多详细信息,请参阅。有两种类型的模块声明:顶级模块声明和本地模块声明
顶级模块声明使用以下语法声明:
module [accessibility-modifier] [qualified-namespace.]module-name
本地模块声明是用
module [accessibility-modifier] module-name =
顶级模块声明必须作为文件中的第一条语句出现,然后模块包含该文件中的所有内容。相反,您可以有多个本地模块声明
请注意,虽然顶级声明还允许您选择性地添加
以提供限定的命名空间,但您不能在本地模块声明中使用
s,尽管您可以嵌套本地模块
在您的情况下,由于您的模块声明没有出现在文件的开头,因此必须编写:
namespace ManageModules
module CreateModule =
...
有关详细信息,请参阅。是。。。我刚想出来。不过我还是会相信你的。谢谢赞成。。。我刚想出来。不过我还是会相信你的。谢谢很高兴你自己发现了。在您的回答中,您没有说明=
工作的原因。直到今天,名称空间/模块的事情仍然时常让我感到困惑。花几个小时来更好地理解原因,否则这个问题在未来会比现在花几个小时来更详细地了解它消耗更多的时间。换言之,你可以现在付一点钱,也可以一次又一次地付,以后会有更多的时间。这就是我发现解决方案时引用的内容。Thx.我只是添加了更多的链接供我使用。当你问问题时,他们会更切中要害,通常会给出所有需要的信息,这使他们成为很好的参考问题。因为我计划将你们的观点回过头来,所以我也将面包屑留给其他细节,让其他人可以通过链接回溯到他们。你做得很好!。很高兴你自己发现了。在您的回答中,您没有说明=
工作的原因。直到今天,名称空间/模块的事情仍然时常让我感到困惑。花几个小时来更好地理解原因,否则这个问题在未来会比现在花几个小时来更详细地了解它消耗更多的时间。换言之,你可以现在付一点钱,也可以一次又一次地付,以后会有更多的时间。这就是我发现解决方案时引用的内容。Thx.我只是添加了更多的链接供我使用。当你问问题时,他们会更切中要害,通常会给出所有需要的信息,这使他们成为很好的参考问题。因为我计划将你们的观点回过头来,所以我也将面包屑留给其他细节,让其他人可以通过链接回溯到他们。你做得很好!。