Previous Method
Definition
- Namespace
- Cuemon.Extensions.Collections.Generic
- Assemblies
- Cuemon.Extensions.Collections.Generic.dll
Previous<T>(IList<T>, int)
Returns the previous element of list relative to index, or the first or last element of list if index is equal, greater or lower than Count.
public static T Previous<T>(this IList<T> list, int index)
Parameters
listIList<T>The IList<T> to extend.
indexintThe index of which to advance to the previous element from.
Returns
- T
default(TSource) if
indexis equal, greater or lower than Count; otherwise the previous element oflistrelative toindex.
Type Parameters
TThe type of elements in the IList<T>.
Exceptions
- ArgumentNullException
listis null.- ArgumentOutOfRangeException
indexis less than 0.