take while c sharp code example
Example 1: while loop in c#
int i = 0;
while (i < 10)
{
Console.WriteLine("Value of i: {0}", i);
i++;
}
Example 2: takewhile c# example
IList<string> strList = new List<string>() {
"Three",
"Four",
"Five",
"Hundred" };
var result = strList.TakeWhile(s => s.Length > 4);
foreach(string str in result)
Console.WriteLine(str);