ListExtensions.WrapIndex<T>

Extension Method in ListExtensions

Declaration

public static int WrapIndex<T>(this List<T> list, int index)

Description

Wraps an index to either end of the list if it is out of bounds.

Type Parameters

TThe type of the list.

Parameters

listThe list to wrap.
indexThe index to wrap.

Returns

intThe wrapped index.