我有这个:
if (Folder == "Unprocessed")
{
var FolderEmails = from emails in EmailManagerDAL.Context.Emails
join activities in EmailManagerDAL.Context.EmailActivities on emails.ID equals activities.EmailID
where activities.EmailID != null
select new { emails.ID, emails.MessageFrom,emails.MessageSubject, emails.MessageDeliveryTime };
}
else // Processed
{
}
我需要将 FolderEmails var 移到“if”之上,但遇到了很多困难。
当然,最初将其设置为 null 是非法的。
我试过这样的东西也不起作用:
var FolderEmails = new { ID = new int(), MessageFrom = string.Empty, MessageSubject = string.Empty, MessageDeliverTime = new DateTime() };
真的可以在这方面使用一些帮助。
谢谢!