CSharp · Console
using System;
using System.Collections.Generic;
using System.Linq;
public class Program
{
public static void Main()
{
List<string> strs = new List<string>{
"a"
,"b"
,"c"
,"d"
,"e"
,"f"
};
var result = from s in strs
where strs.IndexOf(s) % 2 == 0
select s;
Console.WriteLine(string.Join(",",strs));
Console.WriteLine(string.Join(",",result));
Console.WriteLine();
string[] strary = strs.ToArray();
Console.WriteLine(string.Join("$", strary));
Console.WriteLine(string.Join("$", strary, 2,3));
Console.WriteLine();
}
}