Range operator in C# for arrays -
i have 3d array int array
arr1 = new int[2,2,2]; i'd create array, time 2d, part of arr1.
sudo code:
arr2 = arr1[..,..,2] .. means elements
(create 2d array arr1 trird dimension (rank) index equals 2)
but looks there no range operator arrays in c#. right, or overlooked something?
in other languages thre range operators marking elements, example: .. or :
i'd avoid iterate on arr1 array.
you can write own extension
public static void getrange(this int[] array, int start, int end) { //your loop } then use arr1.getrange(1,2)
but there no builtin operator.
Comments
Post a Comment