int[,] matrix = new int[3,3] { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }; matrix.Clear();
double[,] matrix = new double[2,4] { {1.2, 3.4, 5.6, 7.8}, {9.0, 8.1, 7.2, 6.3} }; Array.Clear(matrix, 0, matrix.Length);In this example, we use the static Clear method from the Array class to clear all the values in the matrix. The System Matrix Clear method is part of the System.Numerics package.