📄 filterediter.cs
字号:
using System;
using System.Collections ;
namespace FileredIterator
{
/// <summary>
/// Summary description for KidIterator.
/// </summary>
public class FilteredIterator : IEnumerator {
private ArrayList kids;
private int index;
private string club;
public FilteredIterator(ArrayList kidz, string club) {
kids = kidz;
index = 0;
this.club = club;
}
//------
public bool MoveNext() {
bool more = index < kids.Count-1 ;
if(more) {
Kid kd = (Kid)kids[++index];
more = index < kids.Count;
while(more && ! kd.getClub().Equals (club)) {
kd = (Kid)kids[index++];
more = index < kids.Count ;
}
}
return more;
}
//------
public object Current {
get {
return kids[index];
}
}
//------
public void Reset() {
index = 0;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -