Basically I am trying to do something like this:
image.Layers
which returns an IEnumerable for all layers except the Parent
layer,
/// Concatenates elements to a sequence.
/// The type of the elements of the input sequences.
/// The sequence to concatenate.
/// The items to concatenate to the sequence.
public static IEnumerable ConcatItems(this IEnumerable target, params T[] items)
{
if (items == null)
items = new [] { default(T) };
return target.Concat(items);
}
This solution is based on realbart's answer. I adjusted it to allow the use of a single null
value as a parameter:
var newCollection = collection.ConcatItems(null)