我有一个自定义对象
Public Class oPerson
private properties
...
public properties
...
End Class
然后我收集了oPersons(oPeople):
Public Class oPeople
Inherits Generic.List(Of oPerson)
End Class
多年来一直运作良好,但现在我想与oPeople使用一些收集功能,如:
oPeople.Take(5)
我收到此错误:
无法转换类型为' System.Collections.Generic.List`1 [BusinessLayer.DataContainer.oPerson]'输入' BusinessLayer.DataContainer.oPeople'。
除了更改我的代码:
Dim students As BusinessLayer.DataContainer.oPeople = GetStudents()
为:
Dim students as List(Of BusinessLayer.DataContainer.oPerson) = GetStudents()
我想留下我的oPeople班。