Here\'s how I would add one item to an IEnumerable object:
//Some IEnumerable object
IEnumerable arr = new string[] { \"ABC\", \"DEF\"
Nope, that's about as concise as you'll get using built-in language/framework features.
You could always create an extension method if you prefer:
arr = arr.Append("JKL");
// or
arr = arr.Append("123", "456");
// or
arr = arr.Append("MNO", "PQR", "STU", "VWY", "etc", "...");
// ...
public static class EnumerableExtensions
{
public static IEnumerable Append(
this IEnumerable source, params T[] tail)
{
return source.Concat(tail);
}
}