|
I have a three dimensional array: Dictionary<Vector3i, int[, ,]> m_data = new Dictionary<Vector3i, int[, ,]>(); Here, I try to debug the dictionary: Of course only data.Key displays as expected. How can I debug all the elements of data.Value here as well? Thanks in advance.
(comments are locked)
|
|
How do you want the 3D array to be displayed? There's no way around iterating through all elements. A 3D array is difficult to view in a reasonable way. One would be to treat it like it was a jagged array, so you have 3 nested arrays. Something like that: this is not very helpful if there are many values since the structure is really hard to read. What data is stores in the array? And how many elements per dimension do you have? Just to clarifiy, my example above has an element counr of 2, 2, 3 which is not that much. A function that forms a string like that could look like this: Usually it's better to use a StringBuilder for this, but since it's just for debugging i don't care about performance ;) ps. i just wrote that from scratch so forgive any potential typing / syntax errors ;) edit
(comments are locked)
|
|
I may be misunderstanding you but it looks like you need to override ToString() in your Vector3i object. The data.Key is the only element that is currently typed as Vector3i, and it's printing correctly. It's data.Value, which is an int[,,], that I'm trying to debug.
Jun 09 '12 at 11:05 PM
Xerosigma
Ho ho it certainly does! Reading the question again it was certainly a terrible answer. My apologies.
Jun 09 '12 at 11:34 PM
Datael
(comments are locked)
|

Using "data" and "m_data" is not good practice. The singular form of data is datum. Also, learn the var keyword!