Perhaps this is due to the fact that
static const double[] arr = { 1, 2, 3, 4, 5, 6, 7, 8, 9};
actually the same thing to say
static const double[] arr = new double[]{ 1, 2, 3, 4, 5, 6, 7, 8, 9};
The value assigned to the constant must be ... const. Each reference type is not constant, and an array is a reference type.
As a result of my research, static readonly was used. Or, in your case with a fixed number of doublings, specify all individual identifiers.
Edit (2): A small sidenode, each type can be used by const, but the value assigned to it must be const. For reference types, the only thing you can assign is null:
static const double[] arr = null;
But it is completely useless. Strings are an exception, it is also the only reference type that can be used for attribute arguments.
Dykam Jul 10 '09 at 14:25 2009-07-10 14:25
source share