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.
C#, using GeSHi 1.0.8.8
public static IEnumerable<int> Range(int start, int count)
Parsed in 0.008 seconds at 7.12 KB/s
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 number sequence with the help of range operator. Here is the code for that.
C#, using GeSHi 1.0.8.8
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)
{
Console.WriteLine(num);
}
}
}
}
Parsed in 0.013 seconds at 33.41 KB/s
And here is the output for that as expected.
Hope this will help you..