Question about array subscripting in C#

Posted by Michael J on Stack Overflow See other posts from Stack Overflow or by Michael J
Published on 2011-01-06T14:43:04Z Indexed on 2011/01/06 14:53 UTC
Read the original article Hit count: 152

Filed under:
|
|
|

Back in the old days of C, one could use array subscripting to address storage in very useful ways. For example, one could declare an array as such.

This array represents an EEPROM image with 8 bit words.

BYTE eepromImage[1024] = { ... };

And later refer to that array as if it were really multi-dimensional storage

BYTE mpuImage[2][512] = eepromImage;

I'm sure I have the syntax wrong, but I hope you get the idea.

Anyway, this projected a two dimension image of what is really single dimensional storage.

The two dimensional projection represents the EEPROM image when loaded into the memory of an MPU with 16 bit words.

In C one could reference the storage multi-dimensionaly and change values and the changed values would show up in the real (single dimension) storage almost as if by magic.

Is it possible to do this same thing using C#?

Our current solution uses multiple arrays and event handlers to keep things synchronized. This kind of works but it is additional complexity that we would like to avoid if there is a better way.

© Stack Overflow or respective owner

Related posts about c#

Related posts about c