Open sandboxFocus

Method Buffer

Buffer<T>(IEnumerable<T>)

Evaluates an IEnumerable<T> and stores the result into a List<T>. If the enumerable is already a list, returns the input list. The intended side effect of this method is to completely evaluate the input enumerable.

Declaration
public static List<T> Buffer<T>(this IEnumerable<T> enumerable)
Parameters
Type Name Description
IEnumerable<T> enumerable

An enumerable.

Returns
Type Description
List<T>

A List<T> made from the items of enumerable, or the enumerable object itself it is already a List<T>.

Type Parameters
Name Description
T

Buffer(IEnumerable)

Evaluates an IEnumerable and stores the result into a List<object>. If the enumerable is already a list, returns the input list. The intended side effect of this method is to completely evaluate the input enumerable.

Declaration
public static List<object> Buffer(this IEnumerable enumerable)
Parameters
Type Name Description
IEnumerable enumerable

An enumerable.

Returns
Type Description
List<object>

A List<object> made from the items of enumerable, or the enumerable object itself it is already a List<object>.

Buffer<T>(IEnumerator<T>)

Evaluates an IEnumerator<T>, stores the result into a List<T> and returns an enumerator for this list. If the enumerator is already a list enumerator, returns the input enumerator. The intended side effect of this method is to completely evaluate the input enumerator.

Declaration
public static List<T>.Enumerator Buffer<T>(this IEnumerator<T> enumerator)
Parameters
Type Name Description
IEnumerator<T> enumerator

An enumerator.

Returns
Type Description
List<T>.Enumerator

An enumerator on a List<T> made from the items of enumerator, or the enumerator object itself it is already a List<T> enumerator.

Type Parameters
Name Description
T

Buffer(IEnumerator)

Evaluates an IEnumerator, stores the result into a List<object> and returns an enumerator for this list. If the enumerator is already a list enumerator, returns the input enumerator. The intended side effect of this method is to completely evaluate the input enumerator.

Declaration
public static List<object?>.Enumerator Buffer(this IEnumerator enumerator)
Parameters
Type Name Description
IEnumerator enumerator

An enumerator.

Returns
Type Description
List<object>.Enumerator

An enumerator on a List<object> made from the items of enumerator, or the enumerator object itself it is already a List<object> enumerator.