Class SpanYielding
Provides helper methods for yielding values from a factory into a Span<T>.
public static class SpanYielding
- Inheritance
-
SpanYielding
- Inherited Members
Methods
FillRest<T>(ref SpanYielder<T>)
Fills the rest of the Span<T> from the given instance of SpanYielder<T> using the underlying factory method.
public static ref SpanYielder<T> FillRest<T>(this ref SpanYielder<T> yielder)
Parameters
yielderSpanYielder<T>The SpanYielder<T> that yields values into the Span<T> using its current factory method.
Returns
- SpanYielder<T>
A reference to the provided SpanYielder<T>.
Type Parameters
TThe type of the yielded values.
FillRest<T>(ref SpanYielder<T>, Func<T>)
Fills the rest of the Span<T> from the given instance of SpanYielder<T> using a provided factory method.
public static ref SpanYielder<T> FillRest<T>(this ref SpanYielder<T> yielder, Func<T> factory)
Parameters
yielderSpanYielder<T>The SpanYielder<T> that yields values into the Span<T> using the provided factory method.
factoryFunc<T>The factory method to use for yielding the remaining values.
Returns
- SpanYielder<T>
A reference to the provided SpanYielder<T>.
Type Parameters
TThe type of the yielded values.
For<T>(Span<T>, Func<T>)
Creates a new SpanYielder<T> from the affected Span<T> and the factory method.
public static SpanYielder<T> For<T>(Span<T> span, Func<T> factory)
Parameters
spanSpan<T>The Span<T> that the yielded values will be inserted into.
factoryFunc<T>The factory that will be used to yield values.
Returns
- SpanYielder<T>
The new SpanYielder<T> instance with the provided underlying factory method.
Type Parameters
TThe type of the yielded values.
Remarks
Factory is mutable, and the underlying factory method may be changed from another external source.
For<T>(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 static SpanYielder<T> For<T>(Span<T> span, Func<T> factory, int startingSpanIndex)
Parameters
spanSpan<T>The Span<T> that the yielded values will be inserted into.
factoryFunc<T>The factory that will be used to yield values.
startingSpanIndexintThe first index in the span that the values will be yielded on.
Returns
- SpanYielder<T>
The new SpanYielder<T> instance with the provided underlying factory method.
Type Parameters
TThe type of the yielded values.
Remarks
Factory is mutable, and the underlying factory method may be changed from another external source.
YieldOntoSpan<T>(Span<T>, int, Func<T>)
Yields a number of values into an existing instance of Span<T>.
public static SpanYielder<T> YieldOntoSpan<T>(Span<T> span, int count, Func<T> factory)
Parameters
spanSpan<T>The Span<T> instance to yield the values into.
countintThe number of values to yield.
factoryFunc<T>The factory method whose values will be yielded.
Returns
- SpanYielder<T>
A constructed SpanYielder<T> instance for yielding further into the specified Span<T> with the given factory method.
Type Parameters
TThe type of the yielded values.
YieldOntoSpan<T>(Span<T>, int, Func<T>, int)
Yields a number of values into an existing instance of Span<T>.
public static SpanYielder<T> YieldOntoSpan<T>(Span<T> span, int count, Func<T> factory, int startingIndex)
Parameters
spanSpan<T>The Span<T> instance to yield the values into.
countintThe number of values to yield.
factoryFunc<T>The factory method whose values will be yielded.
startingIndexintThe first index in the span that the values will be yielded on.
Returns
- SpanYielder<T>
A constructed SpanYielder<T> instance for yielding further into the specified Span<T> with the given factory method.
Type Parameters
TThe type of the yielded values.
Yield<T>(ref SpanYielder<T>, int)
public static ref SpanYielder<T> Yield<T>(this ref SpanYielder<T> yielder, int count)
Parameters
yielderSpanYielder<T>countint
Returns
- SpanYielder<T>
Type Parameters
T
Yield<T>(ref SpanYielder<T>, int, Func<T>)
public static ref SpanYielder<T> Yield<T>(this ref SpanYielder<T> yielder, int count, Func<T> factory)
Parameters
yielderSpanYielder<T>countintfactoryFunc<T>
Returns
- SpanYielder<T>
Type Parameters
T