c# - What is the best wayto add single element to an IEnumerable collection? -


i'm surprised see there not appear method add single element ienumerable collection.

how can add single element ienumerable collection?

you can't add elements ienumerable it's supposed read only. best bet either like:

return new list<foo>(enumerable){ new foo() }; 

or

return enumerable.concat(new [] { new foo() }); 

Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

html - Instapaper-like algorithm -

c# - How to execute a particular part of code asynchronously in a class -