Top "Ienumerable" questions

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

IEnumerable vs IReadonlyCollection vs ReadonlyCollection for exposing a list member

I have spent quite a few hours pondering the subject of exposing list members. In a similar question to mine, …

c# .net list ienumerable encapsulation
C# Distinct on IEnumerable<T> with custom IEqualityComparer

Here's what I'm trying to do. I'm querying an XML file using LINQ to XML, which gives me an IEnumerable&…

c# linq-to-xml ienumerable distinct
Return all enumerables with yield return at once; without looping through

I have the following function to get validation errors for a card. My question relates to dealing with GetErrors. Both …

c# ienumerable yield yield-return
Calculating Count for IEnumerable (Non Generic)

Can anyone help me with a Count extension method for IEnumerable (non generic interface). I know it is not supported …

c# .net linq extension-methods ienumerable
Is there an "Empty List" singleton in C#?

In C# I use LINQ and IEnumerable a good bit. And all is well-and-good (or at least mostly so). However, …

c# singleton ienumerable empty-list
How to check if a variable is an IEnumerable of some sort

basically I'm building a very generic T4 template and one of the things I need it to do is say …

c# generics foreach ienumerable
What should I use an IEnumerable or IList?

Can anyone tell me when I should use either. For example, I think I should use an IList when I …

c# ienumerable ilist
ReadOnlyCollection or IEnumerable for exposing member collections?

Is there any reason to expose an internal collection as a ReadOnlyCollection rather than an IEnumerable if the calling code …

c# .net collections ienumerable readonly-collection
Displaying data in a SelectList in ASP.NET Core

I've tried a few different approaches. I'm not sure why but my SelectList/DropDown is empty. It shows no data. …

c# asp.net-mvc asp.net-core ienumerable selectlist