Hi,
I'm having a problem to add an array of contacts to a json object.
My class is:
Public Class HistoryClass
Public Class Contact
Public Property id As String
Public Property displayName As String
End Class
Public Class History
Public Property regarding As String
Public Property startTime As DateTime
Public Property endTime As DateTime
Public Property contacts As Contact()
End Class
End Class
I can successfully POST this json:
Dim h As New HistoryClass.History With {.regarding = "test", .startTime = Now, .endTime = Now}
But how do I add contacts to this?
What I have tried:
h.contacts = New List(Of Contact) With {.id = ContactID}
error: id is not a member of list(of HistoryClass.Contact
h.contacts = New Contact With {.id = ContactID}
error: Value of type HistoryClass.Contact cannot be converted to HistoryClass.Contact()
Dim contactColl As Collection = New Collection
Dim ContactIDlijst As Dictionary(Of String, Contact) = New Dictionary(Of String, Contact)
ContactIDlijst.Add("id", st)
contactColl.Add(ContactIDlijst)
h.contacts = contactVerzameling
error: Value of Collection cannot be converted to HistoryClass.Contact()
I have the feeling it's something I am overlooking but what?
I just need to add contacts to h
Thank you for your time.