implementation of GNU's fold in C# (learning C#)