Javatpoint Logo
Javatpoint Logo

LINQ Range Method

In LINQ, the Range method or operator is used to generate the sequence of integer or numbers based on the specified values of the start index and end index.

Syntax of LINQ Range Method

Here is the syntax of the LINQ Range method to generate the sequence of numbers based on the specified index.

From the above syntax, we defined the Range method with two parameters. Here, the first parameter shows the starting element of the integer, and the second integer is the one which tells us the limit up to which it can display the integer in a sequence.

Example of LINQ Range Method

Here is the example of the LINQ Range method to generate a collection that contains the sequence of numbers.

In the above example, we defined the range from (100,10), so it will take the starting number as "100" and till "109". All this was done because here we defined the second parameter as 10, so it will return the numbers up to 10.

OUTPUT:

LINQ Range Method




Help Others, Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA