This is somewhat asp.net MVC related only for example purposes but I was hoping to achieve something like this:
new SelectList(ViewData.Model.Formats.ToList().ForEach(x => index + ' - ' + x.Name), 'ID', 'Name');
Basically trying to be smart and return ‘index’ as a number 1 – n where n is the number of items in the list ViewData.Model.Formats so my select list has a # prefixed on each entry. Any simple way to do this, or am I looking at making a new list with that append and ditching the lambda trick?
With great help from Neil and Hosam, I got this working with the following:
Anon methods rock!