In this post I am going to explain TakeWhile Operator in details. TakeWhile is one of partitioning operator available in Linq. It will take sequence until condition becomes false.
Here is the example for that.
Here is the example for that.
using System;
using System.Collections.Generic;
using System.Linq;
namespace Linq
{
class Program
{
static void Main(string[] args)
{
int[] numbers ={10,9,8,7,6,5,4,3,2,1};
foreach(var number in numbers.TakeWhile(n=>n>5))
{
Console.WriteLine(number);
}
}
}
}

