Code for adding to IEnumerable

后端 未结 7 1236
日久生厌
日久生厌 2020-12-17 08:42

I have an enumerator like this

IEnumerable page;

How can I add a page (eg: D:\\newfile.txt) to it

7条回答
  •  [愿得一人]
    2020-12-17 09:45

    IEnumerable is immutable. You can't add items, you can't delete items.
    The classes from System.Collections.Generic return this interface so you can iterate over the items contained in the collection.

    From MSDN

    Exposes the enumerator, which supports a simple iteration over a collection of a specified type.
    

    See here for MSDN reference.

提交回复
热议问题