CKTIS / C#
..: practical reference
..: practical reference: .. creates a Range from optional Index bounds for slicing a supported type.
Version: C# operator reference; verified against C# 14
Syntax
left .. right.. creates a Range from optional Index bounds for slicing a supported type.
Use it for readable slices of arrays, spans, and strings.
A span slice is usually a view, whereas a string or array range can allocate a copy.
Bounds may use ^; a reversed or out-of-length range throws.
The complete program actually uses ..; its exact expected stdout is 1,2,3.
Examples
using System;
using System.Linq;
using System.Threading.Tasks;
var values = new[] { 0, 1, 2, 3, 4 }; Console.WriteLine(string.Join(",", values[1..^1]));
Result
1,2,3
The complete program actually uses `..`; its exact expected stdout is `1,2,3`.