I have the following LINQ statement:
IEnumerable<Statement> statement = bookmarkCollection.AsEnumerable().Select(
bookmark => new Statement()
{
Title = bookmark.Title,
PageNumber = bookmark.PageNumber
});
Statement has another attribute called NextPageNumber that I need to be able to populate. NextPageNumber is equal to the PageNumber of the next record minus 1. Esentially, something like this:
IEnumerable<Statement> statement = bookmarkCollection.AsEnumerable().Select(
bookmark => new Statement()
{
Title= bookmark.Title,
PageNumber = bookmark.PageNumber,
NextPageNumber = ???
});
UPDATE:
I attempted some of the solutions provided, but I am stil on .NET 3.5 so the Tuple method is out. The Zip operation works (I have extension methods that simulate Zip for 3.5), but it does not create a Statement for the last Bookmark. The NextPageNumber for the last bookmark would simply be the number of pages in the PDF.
FINAL UPDATE:
Many thanks to everyone. With your help, I was able to get this working appropriately.