I have a VB class that contains an array of other VB classes. Then I serialize an object into xml using
Private Sub Serialize(myObject As Object, myObjectType As Type)
Dim ser As New XmlSerializer(myObjectType)
Dim myWriter As StreamWriter = New StreamWriter("D:\DataTest\myXMLFile.xml")
ser.Serialize(myWriter, myObject)
myWriter.Close()
End Sub
my Classes:
Public Class mySerializableClass
Public Property Name As String
Public Property Adresse As String
Public Property IdF As Integer
Public Property ISC() As myInnerSerializableClass
End Class
Public Class myInnerSerializableClass
Public Property CNSS As String
Public Property nom As String
End Class
Untill now everything works fine (and my xml files is created). But when I replace
Public Property ISC() As myInnerSerializableClass
With
Public Property ISC() As ICollection(Of myInnerSerializableCass)
I get an arror that reads : An error occurred during reflection of type 'myCustomNameSpace.mySerializableClass'
P.S. I need the ICollection for EF code first, or find a way to work with arrays in EF code first.