2

Possible Duplicate:
Array memory allocation - paging

Does byte[,] myArray is always in continuous memory block?

I have some code which works with images stored in such arrays, everything works fine, but I just ask for sure.

EDIT: I work with unsafe code.

Community
  • 1
  • 1
apocalypse
  • 5,764
  • 9
  • 47
  • 95
  • 1
    Take a look at [this answer](http://stackoverflow.com/a/7900793/706456). There is a [reference](http://stackoverflow.com/a/7900786/706456) that: *"In C# you can't guarantee that the memory block will be contiguous. The CLR tries to allocate the memory in one contiguous block, but it may allocate it in several blocks..."* – oleksii Jul 20 '12 at 08:39

1 Answers1

1

Yes, it's always there, in memory and will be memorized consecutively.

take a look : True Unsafe Code Performance

And msdn says you can use without think about it: http://msdn.microsoft.com/en-us/library/28k1s2k6%28v=vs.80%29.aspx

Community
  • 1
  • 1
totten
  • 2,769
  • 3
  • 27
  • 41