C# Feature - Modifiers on simple lambda parameters
Modifiers on simple lambda parameters
Section titled βModifiers on simple lambda parametersβC# 14 allows simple lambda parameter lists to include modifiers such as ref, out, in, ref readonly, and scoped without forcing explicit parameter types for every parameter.
Introduced In
Section titled βIntroduced Inβ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.
Why This Feature Exists
Section titled βWhy This Feature ExistsβBefore C# 14, adding a modifier like out to a lambda parameter forced the lambda back into a fully typed parameter list. That made concise lambdas noticeably noisier.
TryParse<int> parse = (string text, out int result) => int.TryParse(text, out result);TryParse<int> parse = (text, out result) => int.TryParse(text, out result);When To Use It
Section titled βWhen To Use Itβ- Use it when the delegate shape is already clear from the target type.
- Use it to keep lambdas concise in APIs that rely on
ref,out, or similar modifiers.
Common Pitfalls
Section titled βCommon Pitfallsβ- The
paramsmodifier still requires an explicitly typed parameter list. - If the target delegate is not obvious, the shorter syntax can make code harder to read.