For example, i have array of int and i need increase each element by 2. In modern c# with linq and extension methods the obvious solution is:
var array = new[] {1, 2, 3};
array.ForEach(p => p += 2);
But unfortunately, code will not compile, because ForEach is not extension method of IEnumerable, but its a member if List. So i need to use classic foreach loop or cast array to list, but this solutions not so elegant and simple.
Can anybody tell me, why Microsoft design ForEach method as member of List, but not as extension method of IEnumerable?