The Problem: You need to parse a large string (like a substring), but String.Substring() creates a new string object in memory every time, hurting performance.
The Fix: Use Span<T>. It provides a type-safe, memory-safe representation of a contiguous region of arbitrary memory without allocation.
string text = "2023-10-25"; // Instead of text.Substring(0, 4) which allocates... ReadOnlySpan<char> yearSpan = text.AsSpan().Slice(0, 4); int year = int.Parse(yearSpan); // Zero allocation!
