Q: Retrieving constant amount of bytes from array I have a huge byte[] data array. I want to take specific amount of bytes (considering as Blocksize) and do some operation with it and have all the results of each block added one after another in a new array. 
This is my code: 
        int j = 0;
        int number_of_blocks = (data.Length) / 16;
        byte[] one_block = new byte[16];
        byte[] one_block_return = new byte[16];
        byte[] all_block_return = new byte[data.Length];

        for (int i = 0; i < number_of_blocks; i++)
        {
            Array.Copy(data, j, one_block, 0, 16);
            one_block_return = one_block_operation(one_block);
            Array.Copy(one_block_return, 0, all_block_return, j, 16);
            Array.Clear(one_block, 0, one_block.Length);
            j = j + 16;
        }

The only problem of this code is its too slow since my data array is extremely large. So I am expecting a replacement of Array.Copy() which is more faster then this or if someone has a better way to do this. I want to know how many ways to do this and hoping to see variation of coding as well. 
-Thanks

A: What about simple parallelization?
int number_of_blocks = (int)Math.Ceiling((double)data.Length / 16);
byte[] all_block_return = new byte[data.Length];

Parallel.For(0, number_of_blocks - 1, block_no =>
              {
                  var blockStart = block_no * 16; // 16 - block size
                  var blockLength = Math.Min(16, data.Length - blockStart);
                  byte[] one_block = new byte[16];
                  byte[] one_block_return = new byte[16];

                  Array.Copy(data, blockStart, one_block, 0, blockLength);

                  one_block_return = one_block_operation(one_block);

                  Array.Copy(one_block_return, 0, all_block_return, blockStart, blockLength);
              });

It is possible to modyify one_block_operation to take data, blockStart, blockStart + blockLength arguments instead buffer (one_block)? You could avoid one of Array.Copy.
EDIT:
Here is how it works:
Firstly, we need to calculate number or blocks. Then the Parallel.For is executes with specified arguments: start index, end index and delegate that passes one argument - currently processed index. In our case, index is considered to be number of block. Equivalent to this code is:
for (var block_no = 0, block_no <= number_of_blocks - 1; block_no++) {
    delegate(block_no);
}

The only difference is that Parallerl.For runs that loop in multiple threads. The threads count number is not fixed - it dependens on ThreadPool size (according to MSDN it also depedends on many factors).
Due to each deletage could be called independently (and we don't know the order of calling deletagtes) we cannot use variable to store current block start index outside deletegate (like you stored it outside for loop). But if we know to current block number and size of block, calculating block start index is very easy (and it is done in 8th line).
And no - you can't skip 9th line or replace it with const value of 16. Why? Consider follwing sequence:

1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17

We can divide this sequence into two block of size 16: 
1st: [1-16]
2nd: [17]
So, like you see - the second block doesn't contain 16 elements, but only 1. The 9th line calculate actual block size / length, so you can easily avoid IndexOutOfBoundException.
