pointer to 3d array
i have a 3D array and i want to get IntPtr
to point on it so here what i did ..can anyone tell me if it's right or not...
fixed (Int16* mypointer = &myvolume[0, 0, 0])
{
//the开发者_JAVA百科n i cast mypointer as IntPtr
}
notice that myvolume is of dimensions 200 x 100 x 100
Are you sure that what you really want is an unsafe pointer? Using pointers like this is very very rare in C# land.
Eric Lippert recently wrote about a simple class that offers some of the behavior of pointers, without resorting to unsafe code. You might consider extending it to work with your multidimensional arrays.
精彩评论