Table of Contents

Struct ReadOnlyListSegment<T>

Namespace
LibGameAI.Util
Assembly
Util.dll

An efficient read-only wrapper for viewing a list segment as a list.

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

Type Parameters

T

The type of objects in the wrapped list.

Implements
Inherited Members

Constructors

ReadOnlyListSegment(IReadOnlyList<T>, int, int)

Create a new read-only list segment.

public ReadOnlyListSegment(IReadOnlyList<T> innerList, int offset, int count)

Parameters

innerList IReadOnlyList<T>

Wrapped list.

offset int

Index, with respect to the wrapped list, of the first element in the list segment.

count int

Number of items in the list segment.

Exceptions

InvalidOperationException

Thrown if innerList is null or if innerList has less than offset + count elements.

Properties

Count

Number of items in the list segment.

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 list segment.

public IEnumerator<T> GetEnumerator()

Returns

IEnumerator<T>

An enumerator that can be used to iterate through the list segment.