Я всего F # n00b, поэтому я надеюсь, что дам вам достаточно информации.Я создал класс под названием запись.Я создаю несколько экземпляров этого класса с данными из нашей базы данных.Затем я добавляю каждую запись в список записей.я хочу сделать XML-документ с этими записями.
//this is the record data type i created. I also created a sender and recipient data
//type but those are probably not neccessary to understand the issue
type record(id:int, sender:sender, ?recipients: recipient list ) =
let mutable id: int = id
let mutable typ = "Message"
let mutable creation = creation()
let mutable sender = sender
let mutable recipients = recipients
[<XmlIgnore()>]
[<XmlArrayAttribute("recipients")>]
[<XmlArrayItem(typeof<recipient>, ElementName = "recipient")>]
member this.Recipients with get() = recipients and set v = recipients <- v
public new() =
record(12180, sender(12180,"Joe","Plumber","Joe@plumber.com"), list.Empty)
[<XmlElement("id")>]
member this.Id with get() = id and set v = id <- v
[<XmlElement("creation")>]
member this.Creation with get() = creation and set v = creation <- v
[<XmlElement("sender")>]
member this.Sender with get() = sender and set v = sender <- v
//i later call this:
let xmlSerializer = XmlSerializer(typeof<record list>)
Затем я получаю это сообщение об ошибке во время выполнения:
Произошла ошибка, отражающая тип 'Microsoft.FSharp.Collections.FSharpList`1 [XXXX.Compliance.YYYYY.record]».// х и у используются для защиты невинных.