C#中的System.Collections.IEnumerator [英] System.Collections.IEnumerator in c#

查看:77
本文介绍了C#中的System.Collections.IEnumerator的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

int[] myArr = new int[3];
     myArr[0] = 1;
     myArr[1] = 2;
     myArr[2] = 3;
    
     // Displays the values of the Array.
     int i = 0;
     System.Collections.IEnumerator ee = myArr.GetEnumerator();
     ee.MoveNext();


现在我的问题是

ee是接口,因此从它包含的对象中调用MoveNext()方法.因此在这里它是SZArrayEnumerator,但是我没有找到有关此信息?那是什么?


Now my question is that

ee is interface so MoveNext() method is called from object it contains.So here it SZArrayEnumerator But i not found information about this??What is that?

推荐答案

Array implements IEnumerator, and MoveNext method is part of IEnumerator. Using the Method Array.GetEnumerator() returns the IEnumerator for the Array. And Enumerators can be used to read the data in the collection, but they cannot be used to modify the underlying collection.



请参考以下链接:

关于GetEnumerator方法 [



Refer the link below :

About GetEnumerator Method[^]


这篇关于C#中的System.Collections.IEnumerator的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆