Top "Ienumerable" questions

IEnumerable, and its generic counterpart IEnumerable<T> are .NET interfaces for iterating (or enumerating) through a collection of items.

How can I add an item to a IEnumerable<T> collection?

My question as title above. For example, IEnumerable<T> items = new T[]{new T("msg")}; items.ToList().Add(…

c# list ienumerable
LINQ equivalent of foreach for IEnumerable<T>

I'd like to do the equivalent of the following in LINQ, but I can't figure out how: IEnumerable<Item&…

linq foreach ienumerable
IEnumerable vs List - What to Use? How do they work?

I have some doubts over how Enumerators work, and LINQ. Consider these two simple selects: List<Animal> sel = (…

c# linq list ienumerable
Converting from IEnumerable to List

I want to convert from IEnumerable<Contact> to List<Contact>. How can I do this?

c# list ienumerable
Count the items from a IEnumerable<T> without iterating?

private IEnumerable<string> Tables { get { yield return "Foo"; yield return "Bar"; } } Let's say I want iterate on those …

c# .net ienumerable
Returning IEnumerable<T> vs. IQueryable<T>

What is the difference between returning IQueryable<T> vs. IEnumerable<T>, when should one be preferred …

c# linq linq-to-sql ienumerable iqueryable
Convert from List into IEnumerable format

IEnumerable<Book> _Book_IE List<Book> _Book_List How shall I do in order to convert _…

c# asp.net-mvc c#-4.0 ienumerable
Can anyone explain IEnumerable and IEnumerator to me?

Can anyone explain IEnumerable and IEnumerator to me? for example, when to use it over foreach? what's the difference between …

c# ienumerable ienumerator
How to check if IEnumerable is null or empty?

I love string.IsNullOrEmpty method. I'd love to have something that would allow the same functionality for IEnumerable. Is there …

c# .net linq collections ienumerable
How to get the index of an element in an IEnumerable?

I wrote this: public static class EnumerableExtensions { public static int IndexOf<T>(this IEnumerable<T> obj, …

c# .net linq ienumerable indexof