Can anyone help me change this code back to a simple for loop?
public class sT
{
public string[] Description { get; set; }
}
text = sT.Description.Aggregate(text, (current, description) =>
current + ("<option value=" + string.Format("{0:00}", j) + "'>" + j++ + ". " + description+ "</option>"));
The code goes through the elements of an array “Description” and creates a list of options. I would like to do some different processing but I am not sure how to reverse engineer this. Any suggestions would be very welcome.
Aggregate simply loops through the items of the list and passes the result of the delegate to the next call to the delegate.
The first parameter specifies the initial value to start with.