1
我有這個代碼不工作我如何根據f#中的類型定義的對象生成新的不可變對象?
type Option(xsdLocation:string, xmlDirectory:string) =
member this.XsdLocation = xsdLocation
member this.XmlDirectory = xmlDirectory
let a1 = new Option("xsd","xml")
let a2 = {a1 with XsdLocation = "xsd2"}
我得到的錯誤 error FS1129: The type 'Option' does not contain a field 'XsdLocation'
我認爲這是做到這一點的方法,網上很多例子都顯示了其他記錄類型。另外,我對f#很新,所以我不確定這些關鍵字是什麼。 – XenoPuTtSs