.NET Range Operators

May 14, 2020
.net

These new range operators in C# 8.0 are we sweet. If you can remember them.

I love updates to C# that make my life as a developer easier an dbetter. Some are great - interpolation? YES! Auto-properties

I just came acrtoss, because VS told me, about a range operation en lieu of Substring. This is cool.

var variable = originalString.Substring(starts, ends - starts);

turns into

var variable = originalString[starts..ends];

OK - that's sweet. Now I need to remeber to do it instead of magically fast fingers typing out that subsstring function for years!