Copy byte array to another byte array in C#

One solution courtesy of Linq…

Array1 = Array2.ToArray();

EDIT: you do not need to allocate space for Array1 before using this Linq call. The allocation for Array1 is done within ToArray(). More complete example below

byte[] Array2 = new byte[5];
// set values for Array2
byte[] Array1 = Array2.ToArray();

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)