How Can I Use IEnumerator.Reset()?

前端 未结 3 1185
春和景丽
春和景丽 2020-12-05 13:15

How exactly is the right way to call IEnumerator.Reset?

The documentation says:

The Reset method is provided for COM interoperabi

3条回答
  •  北荒
    北荒 (楼主)
    2020-12-05 14:08

    I recommend not using it. A lot of modern IEnumerable implementations will just throw an exception.

    Getting enumerators is hardly ever "expensive". It is enumerating them all (fully) that can be expensive.

提交回复
热议问题