First, I would say that simple arrays clearly represent the wrong data structure for your problem.
How about using where you use 4- tuple as an index?
var lookup = new Dictionary<Tuple<int,int,int,int>, int>();
I never did this myself, but it should work fine. If you do not have a ready-made Tuple because you are working with a version of the .NET Framework prior to .NET 4, you can specify your own index type:
struct LookupKey { public readonly int First; public readonly int Second; public readonly int Third; public readonly int Fourth; … } var lookup = new Dictionary<LookupKey, int>();
stakx
source share