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 a resettable enumerator for this list. If the enumerator is already buffered, resets it and returns the same instance. The intended side effect of this method is to completely evaluate the input enumerator.

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

An enumerator.

Returns
Type Description
RunTimeAspectHelper.Enumerator<T>

An RunTimeAspectHelper.Enumerator<T> that supports Reset().

Type Parameters
Name Description
T

Buffer(IEnumerator)

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

Declaration
public static RunTimeAspectHelper.Enumerator Buffer(this IEnumerator enumerator)
Parameters
Type Name Description
IEnumerator enumerator

An enumerator.

Returns
Type Description
RunTimeAspectHelper.Enumerator

An RunTimeAspectHelper.Enumerator that supports Reset().