I have a static helper method (on a non-static class) that does some calculations, these calculations require a certain data object, in order to keep the the static method short and fast, I want to pre-process this data object and have the static method use it.
But where do I put this data object to be available to the static method, while making sure it is created only once? Should I just put it elsewhere in a singleton?
EDIT: I've been advised to use a static variable inside my class, I tried doing something like the following and when the static method tried to use it it was null:
private const int X = 50;
private const int Y = 10;
private static readonly List<double> CrossSetting =
(from horizontal in Enumerable.Range(0, X)
from vertical in Enumerable.Range(0, Y)
select Process(horizontal, vertical)).ToList();