Reading documentation is always helpful. Take a look at Array Initialization.
How to declare an array of 96 double values inside a Form class in VS2019 with C#
I am very new to C# and VS 2019 most of my coding is typically in C and I am trying to create a program using VS2019 Winforms in C# where I need to declare a named array of 96 doubles as shown below inside a class Form so its values are accessible within the form. I have tried various ways but obviously I am lost here.
Here is my array from C: (obviously I did not put all the 96 values here)
#define E96_ARRAY_ZIZE 96
double E96ser[E96_ARRAY_ZIZE] = { 1.00, 1.02, 1.05, 1.07, 1.10, 1.13, 1.15, 1.18, 1.21, 1.62, 1.65, 1.69, 1.74,,,,,,,,,,,,,,,}
// I have tried things like:
public double E96ser = new double[96] {n,n,n,n,n,n,n,n,n,.......n};
but that gives me all kind of errors.
Thank you all for any suggestions or help!
Developer technologies | C#
2 answers
Sort by: Most helpful
-
-
Anonymous
2023-04-12T08:19:06.63+00:00 Hi @Carlos Barberis , Welcome to Microsoft Q&A, you could try the following code to get what you wanted.
You can't use #define E96_ARRAY_ZIZE 96 in winform;
You can define a value of 96, or create it directly.
//private const int E96_ARRAY_SIZE = 96; // private double[] E96ser = new double[E96_ARRAY_SIZE]{}; private double[] E96ser = new double[96] {1.00, 1.02, 1.05, 1.07, 1.10,...};
Best Regards,
Jiale
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.