Table of Contents

Struct SpanYielder<T>

Namespace
Garyon.Objects
Assembly
Garyon.dll

Provides mechanisms for convenient yielding of a factory's values into a Span<T>, with multiple yield operations applying after the previously iterated indices.

public ref struct SpanYielder<T>

Type Parameters

T

The type of the yielded values.

Inherited Members
Extension Methods

Remarks

Operations for this object are supported through extensions defined in Yielding to support fluent syntax.

Constructors

SpanYielder(Span<T>, Func<T>)

Creates a new SpanYielder<T> from the affected Span<T> and the factory method.

public SpanYielder(Span<T> span, Func<T> factory)

Parameters

span Span<T>

The Span<T> that the yielded values will be inserted into.

factory Func<T>

The factory that will be used to yield values.

SpanYielder(Span<T>, Func<T>, int)

Creates a new SpanYielder<T> from the affected Span<T> and the factory method with a speicifed starting index in the span.

public SpanYielder(Span<T> span, Func<T> factory, int startingSpanIndex)

Parameters

span Span<T>

The Span<T> that the yielded values will be inserted into.

factory Func<T>

The factory that will be used to yield values.

startingSpanIndex int

The first index in the span that the values will be yielded on.

Properties

Factory

The factory that will be used to yield values. You may change this during the lifetime of this instance.

public Func<T> Factory { readonly get; set; }

Property Value

Func<T>

NextSpanIndex

Gets the index in the Span<T> that will be yielded.

public readonly int NextSpanIndex { get; }

Property Value

int

Span

The Span<T> that the yielded values will be inserted into.

public readonly Span<T> Span { get; }

Property Value

Span<T>

Methods

ResetNextIndex()

Resets NextSpanIndex to 0.

public void ResetNextIndex()

ResetNextIndex(int)

Resets NextSpanIndex to the specified value.

public void ResetNextIndex(int index)

Parameters

index int

The index to reset to.

Exceptions

ArgumentOutOfRangeException

Thrown when the index exceeds the span's length.