How can I do the following in C# with less lines of code? I’m just initializing a new list using the fields of elements in an existing collection, but modifying each field before I add it to the list.
List<string> itemDescriptions = new List<string>();
foreach (CoolItem item in _coolItems)
{
itemDescriptions.Add("* " + item.Description);
}
I’m guessing lambda expressions…
this is the LINQ Expression for this :