Class ListUtilityExtensions
This is an extension implementation of the most common methods on the ListUtility class.
Inheritance
Namespace: Cuemon.Collections.Generic
Assembly: Cuemon.Core.dll
Syntax
public static class ListUtilityExtensions
Methods
| Improve this DocHasIndex<TSource>(IList<TSource>, Int32)
Determines whether the elements
of the System.Collections.Generic.IList<T> is within the range of the index
.
Declaration
public static bool HasIndex<TSource>(this IList<TSource> elements, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<TSource> | elements | The elements of the System.Collections.Generic.IList<T>. |
System.Int32 | index | The index to find. |
Returns
Type | Description |
---|---|
System.Boolean |
|
Type Parameters
Name | Description |
---|---|
TSource | The type of elements in the System.Collections.Generic.IList<T>. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
Next<TSource>(IList<TSource>, Int32)
Returns the next element of elements
relative to index
, or the last element of elements
if index
is equal or greater than System.Collections.Generic.ICollection<T>.Count.
Declaration
public static TSource Next<TSource>(this IList<TSource> elements, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<TSource> | elements | The elements, relative to |
System.Int32 | index | The index of which to advance to the next element from. |
Returns
Type | Description |
---|---|
TSource | default(TSource) if |
Type Parameters
Name | Description |
---|---|
TSource | The type of elements in the System.Collections.Generic.IList<T>. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
|
Previous<TSource>(IList<TSource>, Int32)
Returns the previous element of elements
relative to index
, or the first or last element of elements
if index
is equal, greater or lower than System.Collections.Generic.ICollection<T>.Count.
Declaration
public static TSource Previous<TSource>(this IList<TSource> elements, int index)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<TSource> | elements | The elements, relative to |
System.Int32 | index | The index of which to advance to the previous element from. |
Returns
Type | Description |
---|---|
TSource | default(TSource) if |
Type Parameters
Name | Description |
---|---|
TSource | The type of elements in the System.Collections.Generic.IList<T>. |
Exceptions
Type | Condition |
---|---|
System.ArgumentOutOfRangeException |
|