I need to prepend a single value to an IEnumerable (in this case, IEnumerable<string[]>
). In order to do that, I'm creating a List<T>
just to wrap the first value so that I can call Concat
:
// get headers and data together
IEnumerable<string[]> headers = new List<string[]> {
GetHeaders()
};
var all = headers.Concat(GetData());
Yuck. Is there a better way? And how would you handle the opposite case of appending a value?