Complex Multidimensional Array Ops...
I have a C# class that reads in a four-dimensional array from a series of flat text files. The clients of this class won't need access to all of the data at any one time, only certain parts of it. Is there a way I can write a method to return a multidimensional array with specific dimensions eliminated?
For instance, take an array of sales figures:
Code:
double[,,,] dSales = new double[NUM_YEARS, NUM_MONTHS, NUM_SALESPEOPLE, NUM_PRODUCTS];
This array provides sales figures organized by year, month, salesperson, and product. If a client needs access to sales figures of product #2 in August, it only needs a two dimensional array (year and salesperson). The other two dimensions (month and product) have been specified.
Is this even possible? If so, any ideas on how to implement it?
Re: Complex Multidimensional Array Ops...
Quote:
Originally posted by smiley_dood
I have a C# class that reads in a four-dimensional array from a series of flat text files. The clients of this class won't need access to all of the data at any one time, only certain parts of it. Is there a way I can write a method to return a multidimensional array with specific dimensions eliminated?
For instance, take an array of sales figures:
Code:
double[,,,] dSales = new double[NUM_YEARS, NUM_MONTHS, NUM_SALESPEOPLE, NUM_PRODUCTS];
This array provides sales figures organized by year, month, salesperson, and product. If a client needs access to sales figures of product #2 in August, it only needs a two dimensional array (year and salesperson). The other two dimensions (month and product) have been specified.
Is this even possible? If so, any ideas on how to implement it?
Why dont you just write a struct or a class to hold the sales information, then read in the info, then add the object to an arraylist. You can always retrieve the info you want from each object when you need to.