Skip to content

C# Feature - Implicit Span and ReadOnlySpan conversions

Implicit Span and ReadOnlySpan conversions

Section titled “Implicit Span and ReadOnlySpan conversions”

C# 14 adds more implicit conversions involving Span<T>, ReadOnlySpan<T>, and arrays so span-based APIs compose more naturally.

This feature was introduced in C# 14. The official Microsoft Learn page for C# 14 is dated November 18, 2025 and states that C# 14 ships with .NET 10 and Visual Studio 2026.

Span-based APIs are common in modern high-performance .NET code. Earlier language versions already supported spans, but some common conversions still felt more manual than they should. C# 14 improves ergonomics so APIs using spans participate more smoothly in extension calls, overload resolution, and generic inference.

static void Print(ReadOnlySpan<char> value)
{
Console.WriteLine(value.ToString());
}
char[] buffer = ['O', 'K'];
Print(buffer);
  • Use it when designing or consuming APIs that prefer spans over arrays or strings for performance reasons.
  • Expect the biggest benefit in parsing, encoding, serializers, protocol handlers, and tight loops.
  • Better conversions do not change span lifetime rules.
  • Readability still matters; span-heavy APIs should be used when performance is actually relevant, not by default everywhere.