c# - When can IEnumerable not be converted to IList? -


i found code in project i'm working on:

ienumerable<int> foo = ienumerableintvariable ilist<int> ?? ienumerableintvariable.tolist(); 

i know as returns null if can't convert, , tolist() kick in finish job, situations in happen?

among others, consider simple case:

public ienumerable<int> getlistofnumbers() {     (int = 0; < 100; i++)         yield return i; } 

this returns true ienumerable wouldn't implement ilist (msdn). clearly, adding/removing "collection" doesn't make sense, nor elements accessible via index.


Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -