你有这门课
Private Class MyClass
Public Property propertyOne() as String
Public Property propertyTwo() as String
Public Property propertyN() as Integer
End Class
现在我想从 lambda 或 linq 表达式中填充 MyClass 的列表,有些像这样......
Dim myClassList as new List(Of MyClass)
myClassList = (From lOtherList1 in MyOtherList1.GetAll()
join lOtherList2 in MyOterhList2.GetAll() on lOtherList1.Id Equals lOtherList2.Id
Select myClassList.Add(new MyClass With { .propertyOne = lOtherList1.Field1,
.propertyTwo = lOtherList1.Field2,
.propertyN = lOtherList2.Field1 })).Tolist()
但我收到此错误“表达式不产生值”,我如何做到这一点?