Enumerable.Range in C#

Range is a static method defined in Enumerable class. The purpose of this method is to provide a collection of sequential numbers.

The parameters required for the method are the start of the number and the count of numbers.

The Old Fashioned Way

The old fashioned way is to hardcode the values. It is actually annoying to type a big sequence.


New Smart Way

With the help of Enumerable.Range method, the sequence numbers are gettable easily.


Hope this post is useful.

Thanks for reading. Like Method Of Tried in Facebook.