How to pass in an array from a multidimensional array?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Ok, so im probably being a bit noobish here, but having worked with unmanaged C++ for so long, my mind is finding it hard to move to C#!

In C++ lets say I had a method called "DoThis". Now if DoThis takes in as a parameter a pointer to an array I could do something along the lines of:

<div style="text-align:left
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Snippet
int temp[5][4];

for (int i = 0; i < 5; i++)
{
<p style="margin-left:40px DoThis(temp);

}


And that would work just dandy.. So I am now trying to do something in C# with a method which takes in (among other things) a "ref Texture2D[] textureStore", but my texture store stores multiple arrays of textures.. So I now have:

<div style="text-align:left
<div class=codeseg>
<div class=codecontent>
<div class=codesniptitle><span style="width:100% Code Snippet
Texture2D[,] sampleTextureStore = new Texture2D[5,4];
// THIS OBVIOUSLY WONT WORK
for (int i = 0; i < 5; i++)
{
<p style="margin-left:40px DoOtherThing(sampleTextureStore);

}


How is one supposed to get around this problem? Or am I just being super-thick!?


View the full article
 
Back
Top