is it possible to substitute a foreach
loop with a lambda expression in LINQ (.Select)
)?
List<int> l = {1, 2, 3, 4, 5};
foreach (int i in l)
Console.WriteLine(i);
To:
List<int> l = {1, 2, 3, 4, 5};
l.Select(/* print to console */);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…