我有一个IEnumerable<TravelDetails>,我正在尝试将for-loop中的值添加到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
}
}
Run Code Online (Sandbox Code Playgroud)
有人可以帮我弄这个吗.
谢谢,Pawan
我需要一些帮助tabindex,以<div>动态添加到所有元素.我需要为可访问性这样做.如果我指定一个<div>元素,它应该自动添加tabindex到其中的所有元素<div>.
我试过这样的事情:
$('#Latest-News-Content [tabindex]').each(function () {
$(this).attr( 'tabindex', parseInt( $(this).attr('tabindex') ) + 10 )
});
Run Code Online (Sandbox Code Playgroud)
但它似乎没有用.另外,如何为隐藏的元素添加选项卡索引?
例如:
我有一个标题和描述显示在<div>.描述是隐藏的并且有一个jQuery collapser.当我点击标题时,描述会扩展.如何tabindex为所有元素设置?
我是Linq的新手.我正在尝试编写一个linq查询来从一组记录中获取最小值.我需要在同一个查询中使用groupby,where,select和min函数,但是在使用group by子句时遇到问题.这是我写的查询
var data =newTrips.groupby (x => x.TripPath.TripPathLink.Link.Road.Name)
.Where(x => x.TripPath.PathNumber == pathnum)
.Select(x => x.TripPath.TripPathLink.Link.Speed).Min();
Run Code Online (Sandbox Code Playgroud)
我不能一起使用group by,它一直在给错误.
我的查询应该
有人可以告诉我我做错了什么,以及如何达到预期的结果.
谢谢,Pawan