我有一个 Linq 查询,它通过 id 将两个列表联接起来,并返回强类型 List:
List<TestowaKlasaDlaLinq> linqlambda = ListDetailedData.Join(PlacesList, a => a.place.id, b => b.id, (a, b) =>
new TestowaKlasaDlaLinq()
{
Czas = a.startDate.TimeOfDay.ToString(),
Co = a.name,
Miasto = b.address.city,
Miejsce = a.organizer.designation
}).ToList();
目前一切都正常。当我尝试筛选列表时出现问题,例如:
var onlyGdansk = linqlambda.Where(x => x.Miasto.Equals("Gdańsk")).Select(x => x).ToList();
那个错误是这样的:
![enter image description here](https://istack.dev59.com/FKl1u.webp)