正在加载图片...
遍历 可以使用和数组类似的方式 输出结果 for(i=0;i<myset.Count;i++) C:\Windows\system32\cmd.ex 元素序列用 101 1S Console.WriteLine("(0}{1}{2)",i, 151 163 myset[i].sno,myset[i].sname); 108 } 105 foreach方式 ∥遍历 foreach(Student st in myset) 通过对象遍历 Console.WriteLine("{0){1}[2)",i,st.sno,st.sname); i++; 1919 遍历 //遍历 foreach (Student st in myset) { Console.WriteLine(" {0} {1} {2}", i, st.sno, st.sname); i++; } 通过对象遍历 ▪ 可以使用和数组类似的方式 for (i = 0; i < myset.Count; i++) { Console.WriteLine(" {0} {1} {2}", i, myset[i].sno, myset[i].sname); } ▪ foreach 方式 输出结果
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有