本文介绍了LINQ查询关闭我的WPF应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个wpf应用程序.当我运行它关闭.我调试了它,发现这个linq查询关闭了它(我不知道为什么!)
I have a wpf application. when I run it it close. I debugged it and I found that this linq query close it(I don't know why!)
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();
但它关闭了这两种情况.
but it closed it both situations.
推荐答案
在至少一张卡上,NextTime
很可能是null
,或者cards
本身是null
.
Most likely NextTime
is null
on at least one card or cards
itself is null
.
这篇关于LINQ查询关闭我的WPF应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!