Strings In Depth18 / 18
Up next

Span<char>

var s = "hello world";
// AsSpan gives a window with no allocation
ReadOnlySpan<char> span = s.AsSpan();
ReadOnlySpan<char> word = span.Slice(6, 5);
Console.WriteLine(word.ToString());
What you're solving

a no-copy view over text