المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Linq - Get Previous Item By Dtae



C# Programming
06-13-2013, 11:40 PM
I have a List called AllDataItems. An AccountDataItem has a BillingDate. I pull all the AccountDataItems from AllDataItems where the BillingDate equals the SelectedBillingDate.

Now, for each item in AllDataItems, if I didn't find one because that matches the SeletedBillingDate, I need to find the previous one by the BillingDate.

I'd like to do this with Linq, rather than loops, but I'm not sure how to code this. Could someone help with the Linq for this?

Thanks
If it's not broken, fix it until it is