You mean IEnumerable
. It's the base interface of all collection types like arrays or generic List
.
You can for example create a List
:
List ints = new List(){ 1,2,3 };
But since it implements IEnumerable
you could also declare it in this way:
IEnumerable ints = new List(){ 1,2,3 };
This has the advantage that you cannot modify ints
since Remove
comes from ICollection
.
No comments:
Post a Comment