32
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
5
public class Program
6
{
7
public static void Main()
8
{
9
List<string> strs = new List<string>{
10
"a"
11
,"b"
12
,"c"
13
,"d"
14
,"e"
15
,"f"
16
};
17
18
var result = from s in strs
19
where strs.IndexOf(s) % 2 == 0
20
select s;
21
22
Console.WriteLine(string.Join(",",strs));
23
Console.WriteLine(string.Join(",",result));
24
Console.WriteLine();
25
26
string[] strary = strs.ToArray();
27
Console.WriteLine(string.Join("$", strary));
28
Console.WriteLine(string.Join("$", strary, 2,3));
29
Console.WriteLine();
30
31
}
32
}
Cached Result