CA1814: Prefer jagged arrays over multidimensional


For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

Breaking ChangeBreaking

A member is declared as a multidimensional array.

A jagged array is an array whose elements are arrays. The arrays that make up the elements can be of different sizes, leading to less wasted space for some sets of data.

To fix a violation of this rule, change the multidimensional array to a jagged array.

Suppress a warning from this rule if the multidimensional array does not waste space.

The following example shows declarations for jagged and multidimensional arrays.

using System;

namespace PerformanceLibrary
    public class ArrayHolder
        int[][] jaggedArray = { new int[] {1,2,3,4},
                                new int[] {5,6,7},
                                new int[] {8},
                                new int[] {9}
        int [,] multiDimArray = {{1,2,3,4},