Action ou manière de former un tout en assemblant plusieurs éléments
var numbers = [1, 2, 3, 4];
var evenNumbers = new List<int>();
for (int i = 0; i < numbers.Count; i++)
{
if (numbers[i] % 2 == 0)
{
evenNumbers.Add(numbers[i]);
}
}
[ 1, 2, 3, 4 ].Where(n => n % 2 == 0);
[ 1, 2, 3, 4 ]
.Where(n => n % 2 == 0)
.Select(n => 2 * n)
.Sum()
List<int> numbers = new List<int> { 1, 2, 3, 4, 5 };
List<int> squared = new List<int>();
for (int i = 0; i < numbers.Count; i++)
{
squared.Add(numbers[i] * numbers[i]);
}