Array Of Constants
-
What is the practicle way of assigning an array of const values, such as the followiing code does in Visual C++ (6.0): const double RX_TEST_FREQ[] = {136.15, 155.15, 173.95}; TIA!!!
-
What is the practicle way of assigning an array of const values, such as the followiing code does in Visual C++ (6.0): const double RX_TEST_FREQ[] = {136.15, 155.15, 173.95}; TIA!!!
You can't declare a const array in C# in the same meaning as in C++. You can declare readonly double[] RX_TEST_FREQ = new double[] {136.15, 155.15, 173.95}; That would make code like RX_TEST_FREQ = new double[10] invalid, but will still allow RX_TEST_FREQ[1] = 0. In other words, you can't change the array reference, but you can change the array contents. Regards Senthil
-
You can't declare a const array in C# in the same meaning as in C++. You can declare readonly double[] RX_TEST_FREQ = new double[] {136.15, 155.15, 173.95}; That would make code like RX_TEST_FREQ = new double[10] invalid, but will still allow RX_TEST_FREQ[1] = 0. In other words, you can't change the array reference, but you can change the array contents. Regards Senthil
Much appreciated! Thanks again.