我想通过按时间戳降序来保持对象列表的顺序。收到错误消息 - 无法将列表转换为字符串。
模型的采样时间
2018 年 12 月 9 日晚上 11:24:37
public ActionResult A()
{
var model = new AssetTrackersViewModel();
model.AssetTrackers.Add(getAssetDetails_CH("e8", DateTime.Now.Date, DateTime.Now.Date));
model = model.AssetTrackers.OrderByDescending(x => DateTime.Parse(x.time));//error
return View(model);
}
班级
public class AssetTracker
{
public AssetTracker()
{
latitude = new List<string>();
longitude = new List<string>();
time = new List<string>();
}
public string deviceid { get; set; }
public List<string> latitude { get; set; }
public List<string> longitude { get; set; }
public List<string> time { get; set; }
}
public class AssetTrackersViewModel
{
public AssetTrackersViewModel()
{
AssetTrackers = new List<AssetTracker>();
}
public List<AssetTracker> AssetTrackers { get; set; }
}
RISEBY
largeQ
撒科打诨
相关分类