In LINQ, the Range method or operator is useful to generate the sequence of integers or numbers based on specified values of start index and end index.
Following is the syntax of the LINQ Range method to generate a sequence of numbers based on specified index values.
If you observe the above syntax, we defined the Range method with two parameters. Here, the first parameter tells the starting elements of the integer, and the second parameter is the one that tells up to which limit it display the integers in a sequence.
Following is the example of the LINQ Range method to generate a collection that contains a sequence of numbers.
If you observe the above example, we defined Range from (100, 10), so it will take starting number as ”100” and till “109” it will return because here we defined the second parameter as 10, so it will return 10 numbers.
Following is the result of the LINQ Range method example.
This is how we can use the LINQ Range method to generate a collection with a sequence of numbers in c#, vb.net.