using System;
using System.Linq;
using System.Collections.Generic;
class Program
{
static void Main() {
var arr = new int[] { 1, 2, 3, 4, 5, 6 };
Func<int, int> add1 = x => x + 1;
Func<int, int> square = x => x * x;
Func<int, int> cube = x => x * x * x;
var functions = new List<Func<int, int>> {
add1, square, cube
};
foreach (var fn in functions) {
var result = arr.Select(fn);
Console.WriteLine(string.Join(" ", result));
}
}
}
/*
run:
2 3 4 5 6 7
1 4 9 16 25 36
1 8 27 64 125 216
*/