
Partitioning Operator - TakeWhile
The TakeWhile operator yields elements from a sequence while a test is true and then skips the remainder of the sequence.
The example uses TakeWhile to generate the sequence, then iterates over the sequence to print the values.
| using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication4 var firstNumbersLessThan6 = numbers.TakeWhile(n => n < 6); Console.WriteLine("First numbers less than 6:"); Console.ReadLine(); |
Output:
Aspnet Discussion
- - Web application
- - Great Indian Developer Su
- - Aspx page inside Silverli
- - Open aspx page inside Sil
- - Guidance for a novice




