public static T[,] Copy<T>(this T[,] self) { var dst = new T[self.GetLength(0), self.GetLength(1)]; for (var a = 0; a < self.GetLength(0); a++) for (var b = 0; b < self.GetLength(1); b++) dst[a, b] = self[a, b]; return dst; } public static T[,,] Copy<T>(this T[,,] self) { var dst = new T[self.GetLength(0), self.GetLength(1), self.GetLength(2)]; for (var a = 0; a < self.GetLength(0); a++) for (var b = 0; b < self.GetLength(1); b++) for (var c = 0; c < self.GetLength(2); c++) dst[a, b, c] = self[a, b, c]; return dst; }