Wintellect.PowerCollections Namespace
Algorithms Class
Algorithms Methods
GhostDoc Pro Sample Help File

Algorithms..::..NCopiesOf<(Of <(<'T>)>)> Method

Creates an IEnumerator that enumerates a given item n times.

Namespace:  Wintellect.PowerCollections
Assembly:  PowerCollections (in PowerCollections.dll)

Syntax


public static IEnumerable<T> NCopiesOf<T>(
	int n,
	T item
)
Public Shared Function NCopiesOf(Of T) ( _
	n As Integer, _
	item As T _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ NCopiesOf(
	int^ n, 
	T item
)

Type Parameters

T

Parameters

n
Type: Int32
The number of times to enumerate the item.
item
Type: T
The item that should occur in the enumeration.

Return Value

An IEnumerable<T> that yields n copies of item.

Exceptions


ExceptionCondition
ArgumentOutOfRangeExceptionThe argument n is less than zero.

Examples


The following creates a list consisting of 1000 copies of the double 1.0.
C#
List<double> list = new List<double>(Algorithms.NCopiesOf(1000, 1.0));