[转载] C#面向对象设计模式纵横谈——18 Iterator迭代器模式
2012-10-17 08:31
323 查看
主讲:李建忠来源:http://www.microsoft.com/china/msdn/events/webcasts/shared/webcast/consyscourse/CsharpOOD.aspx
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
publicinterfaceIEnumerable
{
IEnumeratorGetEnumerator();
}
publicinterfaceIEnumerator
{
ObjectCurrent{get;}
boolMovenext();
voidReset();
}
privateclassMyEnumerator:IEnumerator
{
intnIndex;
MyCollectioncollection;
publicMyEnumerator(MyCollectioncoll)
{
collection=coll;
nIndex=-1;
}
publicboolMoveNext()
{
nIndex++;
return(nIndex<collection.items.GetLength(0));
}
publicintCurrent
{
get
{
return(collection.items[nIndex]);
}
}
publicvoidReset()
{
nIndex=-1;
}
}
.csharpcode,.csharpcodepre
{
font-size:small;
color:black;
font-family:consolas,"CourierNew",courier,monospace;
background-color:#ffffff;
/*white-space:pre;*/
}
.csharpcodepre{margin:0em;}
.csharpcode.rem{color:#008000;}
.csharpcode.kwrd{color:#0000ff;}
.csharpcode.str{color:#006080;}
.csharpcode.op{color:#0000c0;}
.csharpcode.preproc{color:#cc6633;}
.csharpcode.asp{background-color:#ffff00;}
.csharpcode.html{color:#800000;}
.csharpcode.attr{color:#ff0000;}
.csharpcode.alt
{
background-color:#f4f4f4;
width:100%;
margin:0em;
}
.csharpcode.lnum{color:#606060;}
相关文章推荐
- NET设计模式(18):迭代器模式(Iterator Pattern)(转载)
- .NET设计模式(18):迭代器模式(Iterator Pattern)
- 18.设计模式_行为模式_迭代器模式_Iterator
- .NET设计模式(18):迭代器模式(Iterator Pattern)
- .NET设计模式(18):迭代器模式(Iterator Pattern)
- .NET设计模式(18):迭代器模式(Iterator Pattern)
- .NET设计模式(18):迭代器模式(Iterator Pattern)
- [导入]C#面向对象设计模式纵横谈(18):(行为型模式) Iterator 迭代器模式.zip(8.04 MB)
- .NET设计模式(18):迭代器模式(Iterator Pattern)
- .NET设计模式(18):迭代器模式(Iterator Pattern)(转)
- .NET设计模式(18):迭代器模式(Iterator Pattern)
- C#面向对象设计模式纵横谈 学习笔记18 Iterator迭代器模式(行为型模式)
- Net设计模式实例之迭代器模式(Iterator Pattern)
- 4.3 《硬啃设计模式》 第20章 集合访问的烦恼 - 迭代器模式(Iterator Pattern)
- 23种设计模式之迭代器模式(Iterator)
- 迭代器模式(Iterator Pattern)
- 设计模式C++学习笔记之十四(Iterator迭代器模式)
- Java迭代器模式(Iterator)
- 设计模式(行为型)之迭代器模式(Iterator Pattern)
- 迭代器模式(Iterator pattern)