#2700 refactored c++ style code to C# (use of [,] arrays, int vs uint,..) + corrected IterationsCounter