我正在使用 YamlDotNet 库来序列化 Yaml 中的一些对象。我在 Guid 属性的序列化方面遇到了一些问题。Guid 属性的序列化生成空括号(例如:{})
请参阅下面的代码
Dim l As New List(Of Person)
l.Add(New Person() With {.Firstname = "MyFirstName", .Lastname = "MyLastName", .Id = Guid.NewGuid()})
Using sw As New StreamWriter("output.yaml", False)
Dim serializer = New Serializer()
serializer.Serialize(sw, l)
End Using
此代码将输出:
- Id: {}
Firstname: MyFirstName
Lastname: MyLastName
与班级:
Public Class Person
Public Property Id As Guid
Public Property Frstname As String
Public Property Lastname As String
End Class
我错过了什么还是图书馆的问题?