Hello there,
I'm refactoring a library we currently use, and I'm faced with the following problem.
We used to have the following stuff :
class Blah
{
float[][] data;
public float[] GetDataReference(int index)
{
return data[index];
}
}
For various reasons, I have replaced this jagged array version with a 1 dimensionnal array version, concatenating inner arrays.
My question is : how can I still return a reference to a sub array of data
?
class Blah
{
float[] data;
int rows;
public float[] GetDataReference(int index)
{
// Return a reference data from offset i to offset j;
}
}
I was thinking that unsafe and pointers stuff may be of use, is it doable ?