当我使用此代码时,我能够获得结果
var photos = DataService.GetPhotos();
var groupedPhotos =
from photo in photos
orderby photo.TimeStamp
group photo by photo.TimeStamp.ToString("y") into photosByMonth
select new KeyedList<string, Photo>(photosByMonth);
GroupedPhotos = new List<KeyedList<string, Photo>>(groupedPhotos);
但是当我尝试使用这个
时Deployment.Current.Dispatcher.BeginInvoke(() =>
{
var photos = DataService.GetPhotos();
var groupedPhotos =
from photo in photos
orderby photo.TimeStamp
group photo by photo.TimeStamp.ToString("y") into photosByMonth
select new KeyedList<string, Photo>(photosByMonth);
GroupedPhotos = new List<KeyedList<string, Photo>>(groupedPhotos);
});
我无法得到我的结果,请建议!!