What is the best way to set up multiple static scopes within the same application? I have structs that serve as wrappers over accessing an array.
Here's an example:
class FooClass{
static int[] BarArray;
}
struct FooStruct{
public int BarArrayIndex;
public int BarArrayValue {
get { return FooClass.BarArray[BarArrayIndex]; }
set { FooClass.BarArray[BarArrayIndex] = value; }
}
}
For performance reasons, I don't want to store a reference to BarArray in every instance of FooStruct, hence I declared the array static. However, it's possible that in the future I'll have to work with multiple different BarArrays at the same time (where different instances of the struct should point into different arrays). Is there a way to achieve that without having to store an additional reference in every instance of the structs and not using a static variable neither? If not, what's the best way to use multiple static instances while making the whole application feel as "one application" for the end-user?