ㆍindex, value 사용
<예제>
using System;
using System.Linq;
class ex
{
static void Main(string[] args)
{
int[] a = new int[] { 1, 2, 4 };
string[] b = new string[] { "a", "b", "c", "d" };
var query =
from i in a.Select((value, index) => new { index, value })
from s in b.Select((value, index) => new { index, value })
where i.value == (s.index + 1)
select new
{
i = i.value,
s = s.value
};
foreach (var item in query)
Console.WriteLine($"{item}");
}
}

'C# > 공부기록' 카테고리의 다른 글
[C#] Linq / outjoin (0) | 2023.01.14 |
---|---|
[C#] Linq / 시간 예제 (0) | 2023.01.14 |
[C#] 람다식, Func, Action (0) | 2023.01.14 |
[C#] Linq (0) | 2023.01.14 |
[C#] List<T> (0) | 2023.01.14 |