0

I am reading data from a file, where I am expecting a sequence of data (Array of data).

The data can be of different types...

Array<double>
Array<double[]>
Array<double[,]>
Array<double[,,]>
Array<double[,,,]>
Array<double[,,,,]>
Array<double[,,,,,]>
Array<double[,,,,,,]>
Array<double[,,,,....n]>

Right now, I have used cases for each case and wrote code for maximum 10 dimensions. But I want it to be for n-dimensions.

Is there any other way to write/read data to array without writing nested loops?

Details: (EDIT) I am reading a binary file, in which two things are specified before the data, 1) Dimensions list 2) Element-Limit

I read these list of integers and build my data type. For example:

Dimensions = {15,32,128,5} Element-Limit = {15,32,128,5}

Then I build a 4D- array like this

double[,,,] dataStream = new double[15,32,128,5];

And this dimension and element-limit may be of n-numbers

And one thing more, I am reading a collection of data... this dataStream will go in Array then like this Array<double[,,,]>

6
  • 2
    Please show us your code. Commented Jan 16, 2015 at 4:43
  • 1
    How is your file structured? and How you are planning to interpret the contents? Please give some detailed information. Commented Jan 16, 2015 at 4:47
  • Why don't you use: Array<object> ? Commented Jan 16, 2015 at 4:47
  • What exactly you want to achieve after reading the data? Probably you are looking for dynamic declaration of arrays then see this answer as well as you can use variable to declare the array. Commented Jan 16, 2015 at 4:58
  • @UsmanAzam, why didn't you use List instead of Arrays? Commented Jan 16, 2015 at 5:03

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.