C# - Iterator
来源:互联网 发布:python webui 编辑:程序博客网 时间:2024/06/06 17:13
An iterator can be used to step through collections such as lists and arrays.
An iterator method or get accessor performs a custom iteration over a collection. An iterator method uses the yield return statement to return each element one at a time. When ayield return statement is reached, the current location in code is remembered. Execution is restarted from that location the next time the iterator function is called.
You consume an iterator from client code by using a foreach statement or by using a LINQ query.
The return type of an iterator method orget accessor can be IEnumerable, IEnumerable<T>, IEnumerator, or IEnumerator<T>.
You can use yield break statement to end the iteration.
Iterators were introduced in C# in Visual Studio 2005.
4 0
- C# - Iterator
- C# 中的Iterator
- C# 迭代器Iterator
- Iterator
- Iterator
- Iterator
- iterator
- Iterator
- Iterator
- iterator
- iterator
- Iterator
- iterator
- iterator
- iterator
- Iterator
- iterator
- Iterator
- linux自动安装
- XOR异或
- ztree获取选中节点
- 关于网页的颜色搭配
- [每日练习]三种冒泡排序方法
- C# - Iterator
- PHP的MySQL扩展:PHP访问MySQL的常用扩展函数
- Memcached 的介绍与命令使用
- ScrollView 滚动到最后/前/上/下
- 最大和子数组与最大积子数组(Largest Sum Contiguous Subarray & Maximum Product Subarray)
- CentOS 7 LAMP
- 如何删掉DedeCMS 5.7中自带的织梦链
- JDK安装及环境变量配置
- 主引擎结构入口