This is an easy one, I am sure, but I can't seem to find it on google.
If I have a function:
foo(int[] a) {}
and I want to call it with a subarray of an array:
for instance: myNums[3]+ (i.e. an array {4,5,6}), given myNums:
int[] myNums = { 1,2,3,4,5,6};
Of course, I don't want to create a new array of just those sub items. I certainly could just pass the array and the index, but then I would have to write all the function code with offsets...ugly.
So, how does one do this in C# (.NET 2.0)?
foo(&myNums[3])
is reporting unsafe.
foo(myNums[3])
won't work (it is passing just an int).
Do I need to map this to some kind of collection?