Help with saving array values?

Hi folks, I'm working on getting a real time line graph displaying on my web app and I've been trying a method that involves assigning the value in an array the value of the position above it. the problem being of course that the data in the array is lost every time the class is called so this won't work. I'm used to working with languages with global variables and I'm new to c# so I didnt think it would be a problem, what ways can I use to save the data being held in the array for each time the class is called?

 public class LineChart { [JsonProperty("lineChartData")] private int[] lineChartData; public void SetLineChartData() { lineChartData = new int[30]; lineChartData[0] = lineChartData[1]; lineChartData[1] = lineChartData[2]; lineChartData[2] = lineChartData[3]; lineChartData[3] = lineChartData[4]; lineChartData[4] = lineChartData[5]; lineChartData[5] = (SQL Select statement) } } 

by Borderboy-_- via /r/csharp

Leave a Reply