c# - How do I get previous element of a List<T> -


i have list

var mylist = new list<object> {      new { day = "sunday", id = 15 },     new { day = "monday", id = 20 },      new { day = "tuesday", id = 80 }  }; 

now previous day of given id. e.g. 80 leads monday , sunday should result 20. list ordered id!

ist there easy way determine day-value? ideal linq solution.

var result = mylist.lastordefault(item => item.id < 80); 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -