我有一個wpf應用程序。當我跑它關閉。我調試它,我發現這個LINQ查詢關閉它(我不知道爲什麼!)linq查詢關閉我的wpf應用程序
TodayCards = cards.Where(i => (i.NextTime.Day == DateTime.Now.Day && i.NextTime.Month == DateTime.Now.Month && i.NextTime.Year == DateTime.Now.Year)).Select(i => i).ToList();
我也試過
TodayCards = cards.Where(i => (i.NextTime.Day == DateTime.Now.Day && i.NextTime.Month == DateTime.Now.Month && i.NextTime.Year == DateTime.Now.Year)).ToList();
但關閉它這兩種情況。
是否有例外?如果是這樣,你可以發佈它嗎? – SynerCoder
@SynerCoder沒有例外。只需關閉程序。這很難找到問題,但我發現後運行此行程序關閉 –
這將更清晰:'cards.Where(c => c.NextTime.Date == DateTime.Today).ToList()' –