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? -

c++ - How to modify context menu of internet explorer using IDocHostUIHandler::ShowContextMenu? -

c# - Asterisk click to call -