AlgoMaster Logo

ref readonly Parameters

Last Updated: May 17, 2026

9 min read

C# 12 added ref readonly as a parameter modifier. It tells the compiler to pass a value by reference (no copying) while forbidding the method from modifying what the reference points to. The feature exists for one main reason: large readonly structs that you want to pass cheaply, with a clear signal at the call site that the caller is sharing a real variable, not a temporary.

Premium Content

Subscribe to unlock full access to this content and more premium articles.