百科.dev
全部条目AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
I

iterator

> 编程语言
开源

适用于 C# 和 Unity 的迭代器库

181 stars0 点赞0 次浏览
访问官网GitHub

工具介绍

适用于 C# 和 Unity 的迭代器库

About

  • A no-GC version of C#'s IEnumerator and LINQ
  • Inspired by C++'s and headers
  • Useful for any C# project with additional support for Unity

Getting Started

Unity Projects

Clone or download this repository and copy the JacksonDunstanIterator directory somewhere inside your Unity project's Assets directory.

Non-Unity Projects

Clone or download this repository and add all the .cs files directly under the JacksonDunstanIterator directory to your C# project.

Usage

There are three iterator types:

  • ArrayIterator for managed arrays (T[])
  • ListIterator for List
  • NativeArrayIterator for NativeArray (automatically compiled out when Unity 2018.1+ isn't available)

They all have the same API. Here's the basics of using ArrayIterator:

csharp
// Get an array
int[] array = new [] { 30, 10, 20, 40 };

// Get an iterator to the beginning of the array
ArrayIterator begin = array.Begin();

// Get the value of the iterator
int val = begin.GetCurrent();

// Move to the next element
ArrayIterator second = begin.GetNext();

// Get an iterator to one past the end of the array
ArrayIterator end = array.End();

// Reverse [ 10, 20, 40] so the array is [ 30, 40, 20, 10 ]
second.Reverse(end);

// Search for an element satisfying a condition
ArrayIterator it20 = begin.FindIf(end, e => e < 25);

There is much more functionality available. See the source for more.

To read about the making of this library, see the Enumerables Without the Garbage series:

  • Part 1
  • Part 2
  • Part 3
  • Part 4
  • Part 5
  • Part 6
  • Part 7
  • Part 8

License

MIT

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言