Reputation: 9940
I am accessing the Keys
of an OrderedDictionary
:
Why does it say this?:
Expanding the Results View will enumerate the IEnumerable
I thought anything more concrete than an IEnumerable
(eg ICollection
, IList
etc) are already enumerated?
Upvotes: 0
Views: 152
Reputation:
List<T>
implements both IList<T>
and IEnumerable<T>
. Logically, it cannot be both already enumerated and not already enumerated. The interfaces only define a contract through which you can interact with the object.
What matters is the underlying type implementing the interface. LINQ expression trees use deferred execution, with an object structure representing the pending LINQ operation(s). That underlying type, which implements the interfaces in the question, knows whether it represents such a deferred operation.
In this case, the underlying object does use deferred execution, so VS prompts you.
Upvotes: 3