Neat way of gettings position of my Object in linq collections
- by Steve
I currently have a object called Week. A week is part of a Season object. the season can contain many weeks. What I want to do is find the position of my week (is it the first week in the season (so #1) or is it the second (so #2).
int i = 0;
foreach ( var w in Season.Weeks.OrderBy(w => w.WeekStarts)){
if(w.Id == Id){
…