Arrays might be made static readonly to prevent their contents from being changed. This doesn't have the desired effect because arrays are mutable. The readonly modifier prevents the array from being replaced by a new array but it does not prevent the contents of the array from being changed.

Consider whether the array could be split up into separate constants. If the array cannot be split then you may wish to use a ReadOnlyCollection instead of an array.

In this example the Foo array is readonly but it is still modified by the Main method.

This example uses a ReadOnlyCollection. Any attempt to modify Foo will cause the program not to compile.

  • MSDN, C# Programming Guide, Arrays as Objects.
  • MSDN, ReadOnlyCollection<T>.