首页  编辑  

foreach语句的本质

Tags: /C#/其他技巧/   Date Created:

ArrayList vArrayList = new ArrayList ();

for ( int i = 0 ; i < 10 ; i ++ )

   vArrayList . Add(i);

foreach ( object vObject in vArrayList )

    Console . WriteLine(vObject);

IEnumerator vEnumerator = vArrayList . GetEnumerator();

while (vEnumerator . MoveNext())

    Console . WriteLine(vEnumerator . Current);