如何解决工会案件之间的循环引用?
type ModuleInfo = | Author of Name
| Section of Section
| Duration of Duration
| Url of string
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
"Section"类型未定义.
这是代码:
module ManageModule.Entities
type FirstName = FirstName of string
type LastName = LastName of string
type Name = | First of FirstName
| Last of LastName
| Suffix of string option
type Duration = | Hours of int
| Minutes of int
| Seconds of int
type ModuleInfo = | Author of Name
| Section of Section
| Duration of Duration
| Url of string
type Module = Module of ModuleInfo
type Modules = Modules of ModuleInfo list
type Section = | Introduction of Module
| Conclusion of Module
Run Code Online (Sandbox Code Playgroud)
您可以使用and关键字:
type ModuleInfo =
| Author of Name
| Section of Section
| Duration of Duration
| Url of string
and Module = Module of ModuleInfo
and Modules = Modules of ModuleInfo list
and Section =
| Introduction of Module
| Conclusion of Module
Run Code Online (Sandbox Code Playgroud)