Struct ReadOnlyNativeMemory<T>.Enumerator
Enumerates read-only references to the values of type T in an allocated read-only memory buffer of type T
public struct ReadOnlyNativeMemory<T>.Enumerator : IEnumerator<T>, IEnumerator, IDisposable
- Implements
-
IEnumerator<T>
- Inherited Members
Constructors
Enumerator(ReadOnlyNativeMemory<T>)
Creates a new ReadOnlyNativeMemory<T>.Enumerator for a specified allocated read-only memory buffer of type T
public Enumerator(ReadOnlyNativeMemory<T> nativeMemory)
Parameters
nativeMemoryReadOnlyNativeMemory<T>The allocated read-only 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 readonly 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 ReadOnlyNativeMemory<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.