21
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
List<string> list = new List<string>{"a", "b", "c", "d","c"};
10
List<string> list2 = new List<string>{"a", "c"};
11
12
var result = list.Select((a, b) => new {Value = a, Index = b})
13
.Where(x => list2.Any(d => d == x.Value))
14
.Select(c => c.Index).ToArray();
15
16
foreach (var item in r)
17
{
18
Console.WriteLine(item.ToString());
19
}
20
}
21
}
Cached Result
Value Money
32.7865 32.79
7.03 7.03
7.646 7.65
0.999 1.00
-0.12 -0.12
-7.1 -7.1
-7.6 -7.6
-32.9012 -32.90
32.7865 32.79
7.03 7.03
7.646 7.65
0.999 1.00
-0.12 -0.12
-7.1 -7.1
-7.6 -7.6
-32.9012 -32.90