Table of Contents

Interface IReadOnlyRing<T>

Namespace
LfrlAnvil.Collections
Assembly
LfrlAnvil.Collections.dll

Represents a generic read-only circular range of elements with constant Count.

public interface IReadOnlyRing<out T> : IReadOnlyList<T?>, IReadOnlyCollection<T?>, IEnumerable<T?>, IEnumerable

Type Parameters

T

Element type.

Inherited Members
Extension Methods

Properties

WriteIndex

Specifies a 0-based index of the next position that this ring will overwrite.

int WriteIndex { get; }

Property Value

int

Methods

GetWrappedIndex(int)

Calculates a 0-based index within the bounds of this ring.

[Pure]
int GetWrappedIndex(int index)

Parameters

index int

Base index to calculate.

Returns

int

0-based index within the bounds of this ring.

Exceptions

DivideByZeroException

When size of this ring is equal to 0.

GetWriteIndex(int)

Calculates a 0-based index within the bounds of this ring from (WriteIndex + offset) expression.

[Pure]
int GetWriteIndex(int offset)

Parameters

offset int

Value to add to the WriteIndex.

Returns

int

0-based index within the bounds of this ring.

Exceptions

DivideByZeroException

When size of this ring is equal to 0.

Read(int)

Creates a new IEnumerable<T> instance that enumerates over all elements of this ring, starting from the provided readIndex.

[Pure]
IEnumerable<out T?> Read(int readIndex)

Parameters

readIndex int

0-based index of an element to start at.

Returns

IEnumerable<T>

New IEnumerable<T> instance.