23
1
using System;
2
using System.Linq;
3
using System.Collections.Generic;
4
5
public class Program
6
{
7
public static void Main()
8
{
9
IList<string> strList = new List<string>() {
10
"One",
11
"Two",
12
"Three",
13
"Four",
14
"Five",
15
"Six" };
16
17
var resultList = strList.TakeWhile((s, i) => s.Length > i);
18
19
foreach(string str in resultList)
20
Console.WriteLine(str);
21
22
}
23
}
Cached Result
#1
_________
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#2
_________
10
9
8
7
6
5
4
3
2
1
#3
_________
7
14
21
28
35
42
49
56
63
70
_________
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#2
_________
10
9
8
7
6
5
4
3
2
1
#3
_________
7
14
21
28
35
42
49
56
63
70