I have a class of properties which is being used as part of a web service. The Class has list of another class as one of its properties:
<Serializable()> _ Public Class LessonPlans Public Property Teacher As String Public Property RoomNumber As String Public Property Subject As String Public Property Students As List(Of Student) End Class <Serializable()> _ Public Class Student Public Property FirstName As String Public Property LastName As String End Class
When I work with the LessonPlans class on the local application, I have no problem doing the following:
Dim _NewLesson As New LessonPlans _NewLesson.RoomNumber = "5" _NewLesson.Subject = "English" _NewLesson.Teacher = "Mr Smith" Dim _Students As New List(Of Student) Dim _NewStudent As New Student _NewStudent.FirstName = "James" _NewStudent.LastName = "Jones" _Students.Add(_NewStudent) _NewLesson.Students = _Students
However, when I try to add the following line on the application that consumes the web service:
_NewLesson.Students = _Students
I get an error: Error 6 Value of type 'System.Collections.Generic.List(Of WindowsApplication1.ws_lessons.Students)' cannot be converted to '1-dimensional array of WindowsApplication1.ws_lessons.Students'.