Nicholas Paldino [.NET/C# MVP] wrote:
SushiSean,
You would use the static BlockCopy method on the Buffer class, like so:
Buffer.BlockCopy(array1, 55, 51, array2, 15, 51);
Not to dispute the usefulness of Buffer.BlockCopy(), but it seems to me
that in this case, where one is simply copying from one array to
another, the Array.Copy() method would be preferable (if nothing else,
just from a readability point of view):
Array.Copy(array1, 55, array2, 15, 51);
Also, I think that if one is using Buffer.BlockCopy(), the correct
parameter list is this (basically the same as Array.Copy()):
Buffer.BlockCopy(array1, 55, array2, 15, 51);
Any particular reason for preferring Buffer.BlockCopy()? I prefer
Array.Copy() because it's a method that already exists in the class for
the data type being used (even if it is a static method). Is there
something about BlockCopy() that makes it better?
Pete