Array.Copy: strange exception while concatenating two byte arrays
Posted
by robob
on Stack Overflow
See other posts from Stack Overflow
or by robob
Published on 2010-04-01T22:11:12Z
Indexed on
2010/04/01
22:13 UTC
Read the original article
Hit count: 225
c#
In a application of mine that is developed in C# I have the following code:
byte[] resb = new byte[Buffer.ByteLength(blockAr) + Buffer.ByteLength(previous)]; Array.Copy(blockAr, 0, resb,0, blockAr.Length); Array.Copy(previous, 0, resb, blockAr.Length, previous.Length);
It's a very simple code to concatenate two byte arrays.
The problem is that in some particular situation that I don't know I have that exception:
ArgumentOutOfRangeException: sourceIndex is less than the lower bound of the first dimension of sourceArray.
I cannot see any of strange in my code and I am not able to reproduce the exception.
Could anyone help me to identify the problem?
thanks
© Stack Overflow or respective owner