C# 14 Lambda type inference with out parameter
| | |

C# 14: Simplified parameters with modifiers in lambdas

Lambda expressions have been a core feature of C# for many years, allowing developers to write inline functions or callbacks in a concise way. In C#, a lambda can have explicitly typed parameters (where you specify each parameter’s type) or implicitly typed parameters (where the types are inferred from context). Prior to C# 14, if…

C# 14 partial constructors
| | |

Partial constructors and events in C# 14

C# 14 introduces a new capability to declare instance constructors and events as partial members. This means you can split a constructor or event definition across two parts of a partial class, similar to how C# has long allowed partial methods and partial properties. This means that, one part of a partial class can declare…

Unbound generics used with nameof
| | |

C# 14: nameof support for unbound generic types

C# 14 introduces several small but helpful improvements to the language. One of these new features is an enhancement to the nameof expression – it now supports unbound generic types. In simple terms, you no longer need to plug in a placeholder type argument just to get the name of a generic type. This update…

Generic method type inference with Spans
| | |

Implicit Span conversions in C# 14 – First-class support for Span and ReadOnlySpan

C# 14 introduces a significant enhancement for high-performance code: first-class language support for spans. In particular, it adds new implicit conversions between Span<T>, ReadOnlySpan<T>, and arrays (T[]). This change makes it much easier to work with these types that represent safe, contiguous memory slices without extra allocations. In this article, we’ll explore what span conversions…

C# 14 field-backed properties
| | |

C# 14 – The field keyword and field-backed properties

C# 14 introduces a new contextual keyword, field, that can be used inside a property’s accessors (the get, set, or init blocks) to refer to the property’s backing storage​. In simpler terms, field is a placeholder representing the hidden variable where a property’s value is stored. This keyword lets you add custom logic to automatically…