public void IteratorTest() { var arr = UnsafeArray.Allocate <int>(10); unsafe { var itr = UnsafeArray.GetEnumerator <int>(arr); for (int i = 0; i < 10; i++) { UnsafeArray.Set(arr, i, i * i); } int num = 0; foreach (int i in itr) { Assert.AreEqual(num * num, i); num++; } } UnsafeArray.Free(arr); }
IEnumerator IEnumerable.GetEnumerator() { return(UnsafeArray.GetEnumerator <T>(m_inner)); }
public UnsafeArray.Enumerator <T> GetEnumerator() { return(UnsafeArray.GetEnumerator <T>(m_inner)); }