Okay, I am way outside my comfort zone here and am struggling with new concepts but I hope I can make myself clear.
As I understand it, global variables are very bad in C#
(and are dangerous in general) but I don't really want to get into that debate. After some research I am led to believe that Singletons
can help. Please feel free to offer alternatives here if that is wrong with the situation I describe below.
What I am trying to do is create a dynamic multi-dimensional array
which will contain numerical data. This matrix will be varying in size and must be created during runtime (I am pulling data from a logging device through a GUI).
What I see being a solution is to create a class
which has a variable which can I can get
and set
but with a dynamic size.
public class mySingleton
{
public static int dataSize { get; set; }
public double[] dataSet = new double[dataSize] { get; set; }
}
Something to this effect but obviously this is wrong and does not work. I have been trying to research how to initialize an array at runtime but cannot figure it out, but I also feel like I don't know which terms to search. Any help?