Press "Enter" to skip to content

Index and Range Operators in C# 8

Patrick Smacchia looks at two new operators in C#:

C#8 added the index ^ and range .. operators. In this post I am attempting to demystify both in the most comprehensive way.

Read on for the demos. I’m not sure I like how the range operator is exclusive on the right-hand side, but I suppose it’s just a matter of remembering that in this language, it’s exclusive and in others it can be inclusive.