Range

Creates a collection of integers with all values between first and second parameters.

WARNING

This method isn't available as an extension method.

Parameters

Returns

int first

int second

IEnumerable<int>

Usage

Creating a integer collection in ascending order

IEnumerable<int> result = CollectionModule.Range(1, 10);

//result = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }

Creating a integer collection in descending order

IEnumerable<int> result = CollectionModule.Range(10, 1);

//result = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 }

Creating a single value collection

IEnumerable<int> result = CollectionModule.Range(1, 1);

//result = { 1 }

Last updated