Table of Contents

Struct ListPlusOneWrapper<T>

Namespace
LibGameAI.Util
Assembly
Util.dll

An efficient wrapper for a list plus one element.

public struct ListPlusOneWrapper<T> : IReadOnlyList<T>, IReadOnlyCollection<T>, IEnumerable<T>, IEnumerable

Type Parameters

T

Type of items in the collection.

Implements
Inherited Members

Constructors

ListPlusOneWrapper(IReadOnlyList<T>, T)

Create a new wrapper for a list plus one element.

public ListPlusOneWrapper(IReadOnlyList<T> list, T plusOne)

Parameters

list IReadOnlyList<T>

List to be wrapped.

plusOne T

Extra element to apparently add to the list.

Properties

Count

Number of items in the list (equal to the number of items in the wrapped list plus one).

public readonly int Count { get; }

Property Value

int

this[int]

Gets the element at the specified index.

public T this[int index] { get; }

Parameters

index int

The zero-based index of the element to get.

Property Value

T

The element at the specified index.

Methods

GetEnumerator()

Returns an enumerator that iterates through the wrapped list plus the additional element.

public IEnumerator<T> GetEnumerator()

Returns

IEnumerator<T>

An enumerator that can be used to iterate through the list plus the additional element.