tags:

views:

149

answers:

3

Hi, This is just a quick question in C#.

I have a scenario where I am working with several devices that all have slightly different data to work with.

When I work out which device I am using, I want to set up a common array to use throughout the code, say arrayCommon.

So I want to move the info from device1 to the common array.

Do I have to do this in a loop for each occurance in the array or can u move the whole array into the common array, as you could in Cobol all those years ago ?

Thanks, George.

+7  A: 

I think you are looking for that : Array.Copy

Ahmet Kakıcı
Spot on, thanks.
George
A: 
 Array array = new char["String".Length];
 "String".ToCharArray().CopyTo(array, 0);
identy
A: 

Just a note, if you are needing it in a performance critical section of code, rather use:

Buffer.BlockCopy()

Link here.

Kyle Rozendo