Visual studio feeds

All Visual Studio blogs in one place


Enter your email address:

Delivered by FeedBurner

Increase your website traffic with



Anti-spam: How many eyes has a typical person?

Follow us on FB


TakeWhile operator in linq

AddThis Social Bookmark Button
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. 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); } } } } In the above code you can see that I taken an array of number from 10 to 1 and I am printing number with take while operator and I have putted condition like number should be greater then 5. So it will take sequence of all the number until...(Read whole news on source site)

Home : Blog List : DotNetJaps : TakeWhile operator in linq