could someone help me with the linq statement,
this is what i have so far
public class Categories : ObservableCollection<Category>
{
public Categories() { }
public int getBoardIndex(int BoardId)
{
return (from category in this
from board in category.CategoryBoards
where board.BoardId == BoardId
select IndexOf(board)
);
}
}
board is an item in category and when i pass a bordId ( which is not an index ) it must search for that BoardId in all boards in each category and then return the Index Of that board
how do i do it using Linq?
Thank you so much for all your help!!!
EDIT
This is a much simpler version of the same thing:
Original Version
To get the index of the first matching Board in its own Category, first find the Category, then get the index of the board:
To get the index of the first matching Board in a flattened collection amongst all of the Categories, then @Dan Tao has the best answer.