Range & Index — C#8 features under the radar

Stefan Schranz
ITNEXT
Published in
4 min readFeb 4, 2022

--

Recently I made a few posts about some fancy features embedded in C#8, however, I feel like there is one feature which is super useful, but tends to fly under the radar a lot — Range & Index.

While being the basic building block of a lot of other collections, working with simple arrays was usually very much limited to simple index accessing. Since arrays also implement IEnumerable and are able to use Linq, they still feel comfortable to use, but without that, there is not much to it besides this syntax.

int[] arr = new int[]{1};

--

--

Writer for

26 year old full stack software developer from Germany - Enthusiatic about C#, .Net and Cloud — Visit me at https://dotschranz.net/