Replicate

Creates a collection by replicating the given initial value.

WARNING

This method isn't available as an extension method.

Parameters

Returns

int count

T initial

IEnumerable<T>

Usage

Creating a string collection

IEnumerable<string> result = 
    CollectionModule.Replicate(5, "Hello");

//result = { "Hello", "Hello", "Hello", "Hello", "Hello" }

Last updated