GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Unity3DTraining/DesignPatterns/IteratorPattern at master · UnitySample/Unity3DTraining

Expand file tree

/

IteratorPattern

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

IteratorPattern

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
IteratorPattern
IteratorPattern
 
 
IteratorPattern.sln
IteratorPattern.sln
 
 
README.md
README.md
 
 

README.md

Outline

迭代器模式

定义

提供一种方法顺序访问一个聚合对象中的各个元素,而又不暴露该对象的内部表示。

小结与思考  

迭代器模式分离了集合对象的遍历行为,它抽象出一个迭代器类来负责具体的遍历行为,这样做的好处就是既不暴露集合内部的结构,又可以让外部代码以透明的方式访问集合内部的数据。
迭代器模式适用于以下几种情况:  

  • 当需要访问一个聚集对象的内容而又不想暴露它的内部表示时;  
  • 当希望支持对聚集对象的多种遍历方式时;  
  • 当需要为遍历不同的聚集结构提供统一的对外接口时;
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.