Reputation: 407
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.
Upvotes: 1
Views: 389
Reputation: 25277
Just a note, if you are needing it in a performance critical section of code, rather use:
Buffer.BlockCopy()
Upvotes: 2
Reputation: 237
Array array = new char["String".Length];
"String".ToCharArray().CopyTo(array, 0);
Upvotes: 1