Having a simple model:
public class SimpleClass
{
public string prop1 { get; set; }
public string prop2 { get; set;}
}
And a collection:
List<SimpleClass> myCollection = new List<SimpleClass>();
I want to do the following:
var headerCollection = new List<string>();
foreach(var item in myCollection)
{
headerCollection.add(item.prop1);
headerCollection.add("Total");
headerCollection.add("Date");
//...
headerCollection.add(item.prop2);
}
But I need to use linq to objects.
I tried:
var modifiedHeaders = myCollection
.Select(item => new[] { item.CON_DESCRIPCION, "Total", "Date", item.prop2 });
But it generates a collection of type: List<string[]>. How to solve this?