I am developing a silverlight application (C#) in which I use a custom control Square and the following global variables.
Square[,] arrSquare = new Square[customRows,customColumns]
List<Square> lstSelection;
List<Square> lstEditable;
List<Square> lstSetSquares;
List<Square> lstCancelled;
The lists are time and again used for updating purposes.
The arrSquare comes in picture only when I have to update my above segregated lists.
I have two options in my mind:
-
follow my current architecture of having global variables and not using my primary array
arrSquarefrequently -
Use
LINQ(onarrSquareconverted to locally declaredLists) in methods so that the local objects get destroyed when method gets completed?
If there is any better way, please suggest that.
Please note, the data that I will be dealing with, will be huge.
The question should not be about global vs local variables, it should rather be phrased as “is it better to keep cached copies of calculations or to produce them on the spot as needed?”.
Since your dataset will be huge then obviously performing all calculations on demand is a no-go, so that question is easy to answer.