0

I want to declare constant integer array in my code.

Code C#:

namespace example
{
    public partial class MainWindow : MetroWindow 
    {
        public const int[] ai_pavyzdys = { 186, 186 };
    }
}

I get an error: Error 1 'KET3._2.MainWindow.ai_pavyzdys' is of type 'int[]'. A const field of a reference type other than string can only be initialized with null. C:\Users\Armandas\Desktop\viskas_programavimo\KET3.2\MainWindow.xaml.cs 22 42 KET3.2

How can I fix it to declare const int[]?

armandasalmd
  • 169
  • 3
  • 10

0 Answers0