我有一个IEnumerable<TravelDetails>
,我正在尝试将for
-loop中的值添加到a中List<TravelDetails>
。我不断收到错误消息。
错误15参数1:无法从'System.Collections.Generic.List'转换为'TrafficCore.DataObjects.TripDetails'C:\ TrafficNew \ TI 511-Web \ Traffic 2.0 \ 511Traffic \ 511Traffic \ Models \ DrivingTime.cs
我的代码是
List<TripDetails> tripDetailsCollection = new List<TripDetails>();
foreach (DrivingTimeRoute dtr in dtRoutes)
{
foreach (Trip trip in dtr.Trips)
{
foreach (TripPathLink tpl in trip.TripPathLinks)
{
tplCollection.Add(tpl);
}
IEnumerable<TripDetails> tripDetails = //long Linq-to-Sql here
List<TripDetails> td = tripDetails.ToList();
tripDetailsCollection.Add(td); // <<< Error here
}
}
有人可以帮我弄这个吗。
谢谢Pawan
您能告诉错误发生在哪一行吗?
—
R. Martinho Fernandes