Decompiling the New C# 14 field Keyword

by ivankahlon 12/17/2025, 11:54 AMwith 36 comments

by Kwpolskaon 12/21/2025, 2:08 PM

> If you want to avoid this issue altogether, consider using a source generator library like Mapster. That way, mapping issues can be caught at build time rather than at runtime.

The only winning move is not to play. Mapping libraries, even with source generators, produce lots of bugs and surprising behavior. Just write mappers by hand.

by drysarton 12/21/2025, 2:02 PM

All of the caveats basically boil down to "if you need to access the private backing field from anywhere other than the property getter/setter; then be aware it's going to have a funky non C# compliant field name".

In the EF Core and Automapper type of cases, I consider it an anti-pattern that something outside the class is taking a dependency on a private member of the class in the first place, so the compiler is really doing you a favor by hiding away the private backing field more obscurely.

by politelemonon 12/21/2025, 2:27 PM

I can appreciate the steady syntactic sugar that c# has been introducing these past years, they never feel like an abrupt departure from the consistency throughout. I often think that this is what java could have been if it hadn't been mangled by oracle's influence, unfortunately as much I like java it's pretty obvious that different parts have been designed by disjointed committee members focused on just one thing.

by Suracon 12/22/2025, 8:42 AM

I always shy away from syntax sugars. If I like a private field with setter and getter I write it into my code. The most of the code is written by autocomplete and if I do now like to se it I just fold it away. I have control over the naming and I can set breakpoints into the getter/setter to trap all those case where I somehow write rubbish. I also have the benefit of seeing the field in my debugger and can access them for hydration without the setter. I see no real use in such new keywords. Just my 2 cents

by twoodfinon 12/21/2025, 3:11 PM

How does C# the language or C# the language standard evolution process accommodate a new keyword with such a generic name? Is it context-dependent?

by GuuDon 12/21/2025, 6:41 PM

I feel like in a few more years and 2-3 major versions C# will have all the useful features of F#. It will also keep being much more exciting because our benevolent corporate visionaries manage to add new gotchas with every major and some minor releases

by mwkaufmaon 12/21/2025, 10:51 PM

TL;DR nothing surprising, it's just syntactical sugar.