Hi,
I need to create an array subset. ArraySegment is not really what I look for, since I would like to access the subset as you access any other array. The most important thing is that the subset must not be a copy of the array.
Code:byte[] buffer = new byte[]{ 1, 2, 3, 4, 5 }; int startindex = 1, count = 2; byte[] subarray = Something(buffer, startindex, count); subarray[0] = 8; // Access buffer's position [1] with [0] index on subarray subarray[1] = 9; // Access buffer's position [2] with [1] index on subarray // buffer must now contain { 1, 8, 9, 4, 5 };
Can anyone help me implementing the Something function, please?


Reply With Quote
Bookmarks