> For the complete documentation index, see [llms.txt](https://gabriel-schade-cardoso.gitbook.io/tango/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gabriel-schade-cardoso.gitbook.io/tango/modules/collection/initialize.md).

# Initialize

Creates a collection by calling the given `initializer` on each index.

> &#x20;**WARNING**&#x20;
>
> This method isn't available as an extension method.

| Parameters                                        | Returns         |
| ------------------------------------------------- | --------------- |
| <p>int length</p><p>Func\<int, T> initializer</p> | IEnumerable\<T> |

## Usage

&#x20;**Creating an integer collection**&#x20;

```csharp
IEnumerable<int> result = 
    CollectionModule.Initialize(5, index => index * 2);

//result = { 0, 2, 4, 6, 8 }
```
