Range Operator in Linq.

Linq is almost providing all the functionalities and i have found one another great operator called range operator which will return a sequence of integer number from start point to number of count. Here is the signature of range operator in Linq.
public static IEnumerable<int> Range(int start, int count)
Here the Start means the starting integer of the sequence and count means the number of sequence you want from starting integer. Let’s take a simple example for that where will print 5 to 9 sequence with the help of range operator. Here is the code for that.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
class Program
    static void Main(string[] args)
        var RangeResult = Enumerable.Range(5, 5);
        Console.WriteLine("Range Result");
        foreach (int num in RangeResult)

And here is the output for that as expected.

Hope this will help you..

Technorati Tags: ,,
Shout it
kick it on DotNetKicks.com


  1. Good post. I am bookmarking your blog.. This free meta tag generator tools provides the easy way of generating title and meta tags for seo onpage optimization. free meta tag generator


Post a Comment

Your feedback is very important to me. Please provide your feedback via putting comments.

Popular posts from this blog

Creating PDF with ASP.Net MVC and RazorPDF

Horizontal and vertical scrollbar in HTML5 and CSS3

How to create Rest API(Web API) with ASP.NET Core 1.0