Struct NativeMemory<T>.Enumerator
Enumerates references to the values of type T in an allocated memory buffer of type T
public struct NativeMemory<T>.Enumerator : IEnumerator<T>, IEnumerator, IDisposable
- Implements
-
IEnumerator<T>
- Inherited Members
Constructors
Enumerator(NativeMemory<T>)
Creates a new NativeMemory<T>.Enumerator for a specified allocated memory buffer of type T
public Enumerator(NativeMemory<T> nativeMemory)
Parameters
nativeMemoryNativeMemory<T>The allocated memory buffer of type T which should be enumerated
Remarks
Note: This operation pins the given nativeMemory.
Exceptions
- InvalidOperationException
The NativeMemory<T> instance is invalid (the underlying NativeMemoryManager might have changed)
Properties
Current
Gets the element in the collection at the current position of the enumerator.
public readonly ref T Current { get; }
Property Value
- T
The element in the collection at the current position of the enumerator.
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Remarks
Note: This operation unpins the pin created by constructring this instance of NativeMemory<T>.Enumerator.
MoveNext()
Advances the enumerator to the next element of the collection.
public bool MoveNext()
Returns
- bool
true if the enumerator was successfully advanced to the next element; false if the enumerator has passed the end of the collection.
Exceptions
- InvalidOperationException
The collection was modified after the enumerator was created.