If I have an array with 12 elements and I want a new array with that drops the first and 12th elements. For example, if my array looks like this:
__ __ __ _
C# 8 has a Range and Index type
Range
Index
char[] a = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l' }; Index i1 = 1; // number 1 from beginning Index i2 = ^1; // number 1 from end var slice = a[i1..i2]; // { 'b','c','d','e','f','g','h','i','j' }